Alexis de Tocqueville, a prominent French writer from the early 19th century who extensively studied democracy in America, recognized the significant influence religion has on American society. He observed that American civilization uniquely combines the spirit of religion and the spirit of liberty, blending them harmoniously.
Nearly two centuries later, religion continues to shape the beliefs and values of Americans. To explore the relationship between religious beliefs and social and political views, the Pew Research Center’s Forum on Religion & Public Life conducted a comprehensive survey on religion in America. The first report, published in February 2008, examined the religious affiliations of the American public, as well as changes in affiliation and the diversity of religious traditions.
The latest release of the Landscape Survey provides detailed information on various aspects of religious beliefs and practices in America. This includes the importance of religion in people’s lives, belief in God and the afterlife, worship attendance, and participation in religious activities. The study also investigates public opinion on religion’s impact on society, conflicts between religion and society, and the relationship between religion and life satisfaction.
Using survey responses, the report analyzes the diversity of opinion on political and public policy issues among different religious groups in the United States, including those who are unaffiliated or nominally affiliated with a religious tradition. These issues range from ideological orientation to views on social issues, government size and role, environmental concerns, and foreign affairs.
The Landscape Survey is based on a nationwide survey conducted from May 8 to August 13, 2007, with over 35,000 adult participants. Additional oversampling was conducted for Eastern Orthodox Christians, Buddhists, and Hindus. The study also incorporates data from a 2007 survey of American Muslims, conducted in partnership with other Pew Research Center projects, resulting in interviews with over 36,000 Americans in total.
I would like to divide this project into several chapters, in each chapter I’m gonna search for the answer of my own questions.
Question: How do Americans’ religious beliefs and practices vary across different demographic groups, and what insights can be gained by examining measures such as the importance of religion in people’s lives, belief in God, frequency of prayer, and frequency of worship service attendance?
Explanation: This chapter delves into the diverse religious beliefs and practices of American adults. It begins by exploring the importance individuals attribute to religion in their lives and delves into their perspectives on God, Scripture, miracles, and other religious beliefs. Furthermore, it discusses worship and other congregational activities, as well as devotional practices and spiritual experiences. The chapter also addresses beliefs about religion, including exclusivity in claims to salvation and moral considerations. Along the way, four key measures of religious commitment – importance of religion in people’s lives, belief in God, frequency of prayer, and frequency of worship service attendance – are highlighted for demographic analysis. These measures serve as lenses through which to examine social and political attitudes within religious traditions in subsequent chapters.
Question: What trends have emerged in the religious landscape of the United States in recent years, and how have they impacted the overall attitude of the population toward different subjects?
Explanation: This chapter examines the changing religious landscape and social attitudes in the United States over the past seven years. It explores shifts in religious affiliation, attitudes towards abortion, views on homosexuality, acceptance of evolution, and experiences of spiritual peace. With Christians declining in proportion and the rise of the religiously unaffiliated, societal attitudes have evolved, reflecting greater acceptance and diversity of beliefs. Through this analysis, we gain insight into the evolving dynamics of religion, morality, and personal values in American society.
Question: How can we model and understand the trends and dynamics of religious affiliation changes among American adults?
Explanation: In this revised chapter, our analysis shifts from a broad discussion of religious switching and intermarriage to a more focused examination of the factors influencing religious affiliation changes over time. Utilizing advanced statistical models, including decision trees and Generalized Linear Models (GLM), we delve into the intricacies of religious identity transitions from childhood to adulthood. By examining the predictive power of sociodemographic variables such as income, education, age, and marital status, our models shed light on the underlying patterns that guide religious affiliation changes. We explore the significance of these variables in contributing to an individual’s likelihood of shifting religious identity, providing a nuanced understanding of the factors at play.
Summary: The 2007 U.S. Religious Landscape Study is a comprehensive telephone survey that explores the religious affiliations, beliefs, and practices of the American public. Conducted by the Pew Research Center, this survey provides insights into the religious composition of the U.S. and examines how religion intersects with various aspects of public life.
Dataset Details:
| Aspect | Details |
|---|---|
| Survey Conducted By | Pew Research Center |
| Date of Survey | 2007 |
| Sample Size | Over 35,000 U.S. Adults |
| Methodology | Telephone survey (landline and cellphones) |
| Geographic Coverage | National (U.S.) |
| Population Coverage | 97% of non-institutionalized U.S. adult population |
| Non-Coverage | 3% of U.S. adults not reachable by telephone or non-English/Spanish speakers |
| Data Availability | Publicly available for analysis |
| Funding | The Pew Charitable Trusts, supported by Lilly Endowment Inc. |
| Research Purpose | To inform about religious affiliations, beliefs, and practices; and understand their influence on various aspects of public life |
Summary: The 2014 Religious Landscape Study, following up on the initial 2007 survey, provides updated data on religious affiliations and the changing religious composition in the United States. This extensive survey captures current trends and shifts in religion within the American adult population.
Dataset Details:
| Aspect | Details |
|---|---|
| Survey Conducted By | Pew Research Center |
| Date of Survey | June 4 - Sept. 30, 2014 |
| Sample Size | 35,071 U.S. Adults |
| Methodology | Telephone survey (60% cellphones, 40% landlines) |
| Geographic Coverage | National (U.S.), with at least 300 interviews in every state and the District of Columbia |
| Language | English and Spanish |
| Population Coverage | 97% of non-institutionalized U.S. adult population |
| Non-Coverage | 3% of U.S. adults not reachable by telephone or non-English/Spanish speakers |
| Data Availability | Publicly available for analysis |
| Funding | The Pew Charitable Trusts, supported by Lilly Endowment Inc. |
| Research Purpose | To provide insights into the religious beliefs and practices, as well as the social and political attitudes of the U.S. adults |
These datasets are instrumental for analyzing changes over time in religious beliefs and practices among U.S. adults. They offer a wealth of information that can be utilized to study the relationship between religion and a variety of sociodemographic factors. The data is publicly available and provides a representative snapshot of the religious composition of the United States for the respective years.
This statistical breakdown provides a clear picture of the religious affiliations among survey respondents, focusing on those with more than 100 individuals per religion. It highlights the diversity of religious identities represented in the survey, including Agnostic, Atheist, Buddhist, Hindu, Jewish, Mormon, Muslim, Orthodox, Protestant, Roman Catholic, and others. The larger representation of categories like Protestant and Roman Catholic indicates their significant presence in the surveyed population. Additionally, the inclusion of categories such as “Nothing in particular”, “Agnostic”, “Atheist” underscores the prevalence of religious non-affiliation among respondents. Overall, this breakdown offers a straightforward overview of the religious diversity within the survey sample, facilitating further analysis of attitudes and beliefs across different religious affiliations.
# Load the necessary library
library(readr)
library(igraph)
library(ggraph)
library(colormap)
library(oce)
library(pROC)
library(ggplot2)
library(magrittr) # needs to be run every time you start R and want to use %>%
library(dplyr) # alternatively, this also loads %>%
library(plotly)
library(kableExtra)
library(tidyr)
library(rpart)
library(randomForest)
library(caret)
# Load the dataset 2007
survey_data_2007 <- read_csv("Dataset_2007.csv")
# Load the dataset 2014
survey_data_2014 <- read_csv("Dataset_2014.csv")# Let's say we have the data frame 'survey_data'
survey_data <- data.frame(survey_data_2007$q16)
# Assuming 'q16' is the column for religion
religion_counts_2007 <- survey_data_2007 %>%
count(q16) %>%
filter(n > 100)
# Rename the columns for clarity
colnames(religion_counts_2007) <- c("Religion", "Respondents")
# Calculate the total number of respondents
total_respondents <- sum(religion_counts_2007$Respondents)
# Calculate percentages
religion_counts_2007 <- religion_counts_2007 %>%
mutate(Percentage = (Respondents / total_respondents) * 100)
options(repr.plot.width = 8, repr.plot.height =5)
# Create the bar plot
p <- ggplot(religion_counts_2007, aes(x = reorder(Religion, -Percentage), y = Percentage, fill = Religion) , width = 60 , height = 12) +
geom_bar(stat = "identity") + # Use identity to use the heights of the bars as provided in the data frame
coord_flip() + # Flip coordinates to have horizontal bars
theme_minimal() + # Use a minimal theme for aesthetics
labs(title = "Number of Respondents",
x = "",
y = "") +
theme(legend.position = "none") # Remove the legend
# Make it interactive
interactive_plot <- ggplotly(p , width = 1200 , height = 500)
# Show the interactive plot in your default browser
interactive_plot
Question:
“How important is religion in your life?”
Very Important: A significant proportion of respondents from various religious backgrounds, including Jehovah’s Witnesses, Mormons, Muslims, Orthodox Christians, Protestants, Roman Catholics, and Unitarians, consider religion to be highly important in their lives. These individuals prioritize religious beliefs and practices as integral aspects of their identity and worldview.
Somewhat Important: Another sizable segment of respondents, spanning diverse religious groups such as Buddhists, Hindus, and those with no particular religious affiliation, view religion as somewhat important in their lives. While not as central as for those who consider it very important, these individuals still recognize the value of religious beliefs and traditions to some extent.
Not Too Important or Not at All Important: A minority of respondents, particularly atheists and agnostics, express that religion holds little to no importance in their lives. They either do not believe in religious concepts or do not actively engage with religious practices, indicating a lack of significance of religion in shaping their personal identities or guiding their daily lives.
religion_importance <- survey_data_2007 %>%
group_by(q16) %>%
filter(n() > 100) %>% # Keep only religions with more than 100 respondents
ungroup() %>%
filter(!is.na(q16), !is.na(q21)) %>% # Ensure q16 and q21 are not NA
group_by(q16, q21) %>%
summarise(Count = n(), .groups = 'drop') %>% # Count occurrences and drop grouping
ungroup() %>%
group_by(q16) %>%
mutate(Total = sum(Count),
Percentage = (Count / Total) * 100) %>%
ungroup() %>%
arrange(q16, q21)
p <- ggplot(religion_importance, aes(x = q16, y = q21, fill = Percentage)) +
geom_tile() + # Create the tiles for the heatmap
scale_fill_gradient(low = "white", high = "steelblue") + # Gradient from white (low) to steel blue (high)
theme_minimal() +
theme(axis.text.x = element_text(angle = 45, hjust = 1), axis.text.y = element_text(size = 12), title = element_text(size = 20)) +
labs(title = "Percentage of Responses on the Importance of Religion by Religious Group",
x = "Religion",
y = "Importance",
fill = "Percentage")
# Make it interactive
interactive_plot <- ggplotly(p , width = 1200 , height = 750)
# Show the interactive plot in your default browser
interactive_plotConclusion:
The data underscores the diversity of attitudes toward religion among individuals of various religious affiliations. While some prioritize religion as a fundamental aspect of their lives, others assign varying degrees of importance to it, and some do not consider it significant at all. Understanding these perspectives is essential for appreciating the complex role that religion plays in shaping individual identities and societal dynamics.
religion_importance_selected <- select(religion_importance, q16, q21, Percentage)
religion_importance_wide <- pivot_wider(
religion_importance_selected,
names_from = q21, # This column's unique values will become the names of the new columns
values_from = Percentage, # The cell values will come from the 'Percentage' column
values_fill = list(Percentage = 0) # Fill missing combinations with 0%
)
colnames(religion_importance_wide)[1] <- "Religion"
# Create the table with kable and add styling with kableExtra
table <- kable(religion_importance_wide, "html", align = c('l', rep('c', 10))) %>%
kable_styling("striped", full_width = F) %>%
add_header_above(c(" " = 1, "How important is religion in your life" = 4, " " = 1)) %>%
row_spec(0, bold = T, color = "white", background = "#636363") %>%
column_spec(1, bold = T)
# If you want to see the table in RStudio's Viewer
table| Religion | Don’t know/Refused (VOL.) | Not at all important | Not too important | Somewhat important | Very important |
|---|---|---|---|---|---|
| Agnostic (not sure if there is a God) | 1.4527845 | 43.8256659 | 33.414044 | 16.101695 | 5.205811 |
| Atheist (do not believe in God) | 2.3300971 | 74.5631068 | 11.844660 | 7.766990 | 3.495146 |
| Buddhist | 2.1897810 | 6.3260341 | 17.761557 | 37.469586 | 36.253041 |
| Christian (VOL) | 3.2534247 | 4.7945205 | 7.876712 | 24.143836 | 59.931507 |
| Don’t know/Refused (VOL) | 19.2000000 | 18.8000000 | 15.600000 | 25.600000 | 20.800000 |
| Hindu | 0.7782101 | 3.1128405 | 12.451362 | 41.634241 | 42.023346 |
| Jehovah’s Witness (VOL) | 0.9389671 | 0.4694836 | 1.408451 | 8.450704 | 88.732394 |
| Jewish (Judaism) | 0.8797654 | 9.8240469 | 18.035191 | 40.469208 | 30.791789 |
| Mormon (Church of Jesus Christ of Latter-day Saints/LDS) | 0.0000000 | 1.0327022 | 2.409639 | 10.843374 | 85.714286 |
| Muslim (Islam) | 0.0000000 | 4.3103448 | 7.758621 | 23.275862 | 64.655172 |
| Nothing in particular | 1.7534394 | 28.2168870 | 24.143512 | 27.596439 | 18.289722 |
| Orthodox (Greek, Russian, or some other orthodox church) | 0.0000000 | 3.3057851 | 8.815427 | 30.578512 | 57.300275 |
| Protestant | 0.5557674 | 1.3676238 | 4.724023 | 22.497684 | 70.854901 |
| Roman Catholic | 0.4970797 | 1.6527899 | 7.033677 | 32.757549 | 58.058904 |
| Unitarian (Universalist) (VOL) | 3.2467532 | 11.0389610 | 13.636364 | 37.662338 | 34.415584 |
The survey highlights a significant gender disparity regarding the importance of religion in individuals’ lives, with women more likely than men to consider religion very important. This trend persists across various religious groups.
Furthermore, age plays a substantial role in determining the importance of religion, with older adults more likely than younger adults to prioritize it. For instance, less than half (45%) of adults under 30 view religion as very important, contrasting with over two-thirds (68%) of those aged 60 and older.
Regarding education, the survey indicates that individuals with lower levels of education tend to place greater importance on religion in their lives.
religion_importance_gender <- survey_data_2007 %>%
group_by(sex) %>%
filter(n() > 100) %>% # Keep only religions with more than 100 respondents
ungroup() %>%
filter(!is.na(sex), !is.na(q21)) %>% # Ensure q16 and q21 are not NA
group_by(sex, q21) %>%
summarise(Count = n(), .groups = 'drop') %>% # Count occurrences and drop grouping
ungroup() %>%
group_by(sex) %>%
mutate(Total = sum(Count),
Percentage = (Count / Total) * 100) %>%
ungroup() %>%
arrange(sex, q21)
religion_importance_gender_selected <- select(religion_importance_gender, sex, q21, Percentage)
religion_importance_gender_wide <- pivot_wider(
religion_importance_gender_selected,
names_from = q21, # This column's unique values will become the names of the new columns
values_from = Percentage, # The cell values will come from the 'Percentage' column
values_fill = list(Percentage = 0) # Fill missing combinations with 0%
)
colnames(religion_importance_gender_wide)[1] <- "Sex"
# Create the table with kable and add styling with kableExtra
table <- kable(religion_importance_gender_wide, "html") %>%
kable_styling("striped", full_width = T) %>%
add_header_above(c(" " = 1, "How important is religion in your life" = 4, " " = 1)) %>%
row_spec(0, bold = T, color = "white", background = "#636363") %>%
scroll_box( height = "100%") %>%
column_spec(1, bold = T)
# If you want to see the table in RStudio's Viewer
table| Sex | Don’t know/Refused (VOL.) | Not at all important | Not too important | Somewhat important | Very important |
|---|---|---|---|---|---|
| Female | 0.8928108 | 4.988321 | 6.405398 | 23.01064 | 64.70283 |
| Male | 1.0005525 | 9.250506 | 11.540114 | 28.59861 | 49.61021 |
filtered_data_age <- survey_data_2007 %>%
filter(!is.na(age) & as.numeric(age) >= 10) # This removes NA values and ensures age is 10 or more## Warning: There was 1 warning in `filter()`.
## ℹ In argument: `!is.na(age) & as.numeric(age) >= 10`.
## Caused by warning:
## ! NAs introduced by coercion
filtered_data_age <- filtered_data_age %>%
mutate(age_numeric = as.numeric(as.character(age)), # Convert age from string to numeric
AgeGroup = cut(age_numeric,
breaks = c(10, 20, 30, 40, 50, 60, 70, 80, Inf),
labels = c("10-20", "20-30", "30-40", "40-50", "50-60", "60-70", "70-80", "80+"),
right = FALSE)) %>%
filter(!is.na(AgeGroup)) # Exclude entries that could not be converted to numeric (including "Don’t know/Refused (VOL.)")
religion_importance_age <- filtered_data_age %>%
group_by(AgeGroup) %>%
filter(n() > 100) %>% # Keep only religions with more than 100 respondents
ungroup() %>%
filter(!is.na(AgeGroup), !is.na(q21)) %>% # Ensure q16 and q21 are not NA
group_by(AgeGroup, q21) %>%
summarise(Count = n(), .groups = 'drop') %>% # Count occurrences and drop grouping
ungroup() %>%
group_by(AgeGroup) %>%
mutate(Total = sum(Count),
Percentage = (Count / Total) * 100) %>%
ungroup() %>%
arrange(AgeGroup, q21)
religion_importance_age_selected <- select(religion_importance_age, AgeGroup, q21, Percentage)
religion_importance_age_wide <- pivot_wider(
religion_importance_age_selected,
names_from = q21, # This column's unique values will become the names of the new columns
values_from = Percentage, # The cell values will come from the 'Percentage' column
values_fill = list(Percentage = 0) # Fill missing combinations with 0%
)
colnames(religion_importance_gender_wide)[1] <- "Age"
# Create the table with kable and add styling with kableExtra
table <- kable(religion_importance_age_wide, "html") %>%
kable_styling("striped", full_width = F) %>%
add_header_above(c(" " = 1, "How important is religion in your life" = 4, " " = 1)) %>%
row_spec(0, bold = T, color = "white", background = "#636363") %>%
scroll_box(height = "100%") %>%
column_spec(1, bold = T)
# If you want to see the table in RStudio's Viewer
table| AgeGroup | Don’t know/Refused (VOL.) | Not at all important | Not too important | Somewhat important | Very important |
|---|---|---|---|---|---|
| 10-20 | 0.1042753 | 10.636079 | 12.200209 | 35.03650 | 42.02294 |
| 20-30 | 0.5787390 | 8.559245 | 12.671337 | 31.98294 | 46.20774 |
| 30-40 | 0.6489676 | 7.649951 | 10.383481 | 29.61652 | 51.70108 |
| 40-50 | 0.7569012 | 6.144257 | 9.349956 | 27.17424 | 56.57465 |
| 50-60 | 0.8131183 | 7.074129 | 9.147581 | 25.65388 | 57.31129 |
| 60-70 | 1.0150444 | 6.978430 | 7.123437 | 22.40348 | 62.47961 |
| 70-80 | 1.0983123 | 5.973748 | 5.679079 | 18.53737 | 68.71149 |
| 80+ | 1.2072435 | 4.778672 | 4.728370 | 17.85714 | 71.42857 |
religion_importance_edu <- survey_data_2007 %>%
group_by(educ) %>%
filter(n() > 100) %>% # Keep only religions with more than 100 respondents
ungroup() %>%
filter(!is.na(educ), !is.na(q31)) %>% # Ensure q16 and q31 are not NA
group_by(educ, q31) %>%
summarise(Count = n(), .groups = 'drop') %>% # Count occurrences and drop grouping
ungroup() %>%
group_by(educ) %>%
mutate(Total = sum(Count),
Percentage = (Count / Total) * 100) %>%
ungroup() %>%
arrange(educ, q31)
religion_importance_edu_selected <- select(religion_importance_edu, educ, q31, Percentage)
religion_importance_edu_wide <- pivot_wider(
religion_importance_edu_selected,
names_from = q31, # This column's unique values will become the names of the new columns
values_from = Percentage, # The cell values will come from the 'Percentage' column
values_fill = list(Percentage = 0) # Fill missing combinations with 0%
)
colnames(religion_importance_edu_wide)[1] <- "Education"
# Create the table with kable and add styling with kableExtra
table <- kable(religion_importance_edu_wide, "html") %>%
kable_styling("striped", full_width = T) %>%
add_header_above(c(" " = 1, "How important is religion in your life" = 4, " " = 1)) %>%
row_spec(0, bold = T, color = "white", background = "#636363") %>%
scroll_box( height = "100%") %>%
column_spec(1, bold = T)
# If you want to see the table in RStudio's Viewer
table| Education | Absolutely certain | Don’t know/refused (VOL.) | Fairly certain | Not at all certain | Not too certain |
|---|---|---|---|---|---|
| College graduate (B.S., B.A., or other 4-year degree) | 74.93427 | 0.5550687 | 20.17236 | 1.2269939 | 3.111306 |
| Don’t know/Refused (VOL.) | 76.85185 | 2.7777778 | 18.98148 | 0.0000000 | 1.388889 |
| High school graduate (Grade 12 or GED certificate) | 81.14176 | 0.5879838 | 15.45863 | 0.5772931 | 2.234338 |
| High school incomplete (Grades 9-11) | 80.89725 | 0.8200675 | 15.43657 | 0.3376749 | 2.508442 |
| None, or grade 1-8 | 75.63218 | 1.9540230 | 17.93103 | 1.3793103 | 3.103448 |
| Post-graduate training or professional schooling after colle | 70.87993 | 0.9706689 | 22.36759 | 1.2449884 | 4.536822 |
| Some college, no 4-year degree (including associate degree) | 80.16148 | 0.6920415 | 16.18608 | 0.6535948 | 2.306805 |
| Technical, trade, or vocational school AFTER high school | 82.21344 | 0.7905138 | 14.72332 | 0.6916996 | 1.581028 |
The survey reveals a widespread belief in God or a universal spirit among American adults, with more than nine-in-ten (92%) affirming this belief. This includes the vast majority of individuals from every major religious tradition, with virtually all Mormon respondents and at least 95% of Catholics, Orthodox Christians, Jehovah’s Witnesses, and members of all three Protestant traditions expressing belief. Even among those not affiliated with a specific religious group, seven-in-ten acknowledge their belief in God or a universal spirit. Notably, a substantial portion of self-described atheists (21%) and more than half of self-described agnostics (55%) also profess belief in God or a universal spirit.
God_belief <- survey_data_2007 %>%
filter(q30 == 'Yes') %>%
group_by(q16) %>%
filter(n() > 100) %>% # Keep only religions with more than 100 respondents
ungroup() %>%
filter(!is.na(q16), !is.na(q30)) %>% # Ensure q16 and q21 are not NA
group_by(q16, q31) %>%
summarise(Count = n(), .groups = 'drop') %>% # Count occurrences and drop grouping
ungroup() %>%
group_by(q16) %>%
mutate(Total = sum(Count),
Percentage = (Count / Total) * 100) %>%
ungroup() %>%
arrange(q16, q31)
p <- ggplot(God_belief, aes(x = q16, y = q31, fill = Percentage)) +
geom_tile() + # Create the tiles for the heatmap
scale_fill_gradient(low = "white", high = "steelblue") + # Gradient from white (low) to steel blue (high)
theme_minimal() +
theme(axis.text.x = element_text(angle = 45, hjust = 1), axis.text.y = element_text(size = 12) , title = element_text(size = 15)) +
labs(title = "believe in God or a universal spirit",
x = "Religion",
y = "",
fill = "Percentage")
# Make it interactive
interactive_plot <- ggplotly(p , width = 1200 , height = 750)
# Show the interactive plot in your default browser
interactive_plotThere is notable variability in the certainty and nature of individuals’ beliefs in God. While at least nine-in-ten Mormons, Jehovah’s Witnesses and Protestant express absolute certainty in the existence of God, smaller majorities of other religious groups also share this conviction. Specifically, Muslims (82%), Catholics (72%), Orthodox Christians (71%), and Hindus (57%) report being completely certain of the existence of God or a universal spirit. In contrast, fewer than half of Jews (41%) and Buddhists (39%) express absolute certainty in the existence of God or a universal spirit. Notably, approximately one-third of the unaffiliated (36%) assert absolute certainty in the existence of God or a universal spirit, with 8% of atheists claiming absolute certainty in this belief.
God as a Person: The majority of respondents across different religious affiliations perceive God as a person. This belief is particularly strong among Jehovah’s Witnesses (86.06%), Mormons (92.39%), and Protestants (73.98%).
God as an Impersonal Force: A significant portion of respondents, though smaller compared to those who view God as a person, conceive of God as an impersonal force. This perspective is notably prevalent among Buddhists (61.84%), Hindus (59.75%), and Unitarians (61.11%).
Other/Both/Neither: Some respondents express conceptions of God that do not fit neatly into the categories of “person” or “impersonal force.” This group includes individuals who may perceive God in multifaceted ways or hold beliefs outside the typical paradigms of personal or impersonal deities.
God_conception <- survey_data_2007 %>%
filter(q30 == 'Yes') %>%
group_by(q16) %>%
filter(n() > 100) %>% # Keep only religions with more than 100 respondents
ungroup() %>%
filter(!is.na(q16), !is.na(q32)) %>% # Ensure q16 and q21 are not NA
group_by(q16, q32) %>%
summarise(Count = n(), .groups = 'drop') %>% # Count occurrences and drop grouping
ungroup() %>%
group_by(q16) %>%
mutate(Total = sum(Count),
Percentage = (Count / Total) * 100) %>%
ungroup() %>%
arrange(q16, q32)
God_conception_selected <- select(God_conception, q16, q32, Percentage)
God_conception_wide <- pivot_wider(
God_conception_selected,
names_from = q32, # This column's unique values will become the names of the new columns
values_from = Percentage, # The cell values will come from the 'Percentage' column
values_fill = list(Percentage = 0) # Fill missing combinations with 0%
)
colnames(God_conception_wide)[1] <- "God Conception"
# Create the table with kable and add styling with kableExtra
table <- kable(God_conception_wide, "html") %>%
kable_styling("striped", full_width = T) %>%
add_header_above(c(" " = 1, "Conception of God among who believed in God" = 3, " " = 1)) %>%
row_spec(0, bold = T, color = "white", background = "#636363") %>%
scroll_box( height = "100%") %>%
column_spec(1, bold = T)
# If you want to see the table in RStudio's Viewer
table| God Conception | Both/Neither/Other (VOL.) | Don’t know/refused (VOL.) | God is a person | God is an impersonal force |
|---|---|---|---|---|
| Agnostic (not sure if there is a God) | 5.909091 | 3.6363636 | 24.54545 | 65.909091 |
| Buddhist | 10.855263 | 3.9473684 | 23.35526 | 61.842105 |
| Christian (VOL) | 6.909091 | 5.4545455 | 64.72727 | 22.909091 |
| Don’t know/Refused (VOL) | 13.071895 | 15.0326797 | 31.37255 | 40.522876 |
| Hindu | 6.779661 | 2.5423729 | 30.93220 | 59.745763 |
| Jehovah’s Witness (VOL) | 3.365385 | 0.9615385 | 86.05769 | 9.615385 |
| Jewish (Judaism) | 4.821429 | 4.8214286 | 27.50000 | 62.857143 |
| Mormon (Church of Jesus Christ of Latter-day Saints/LDS) | 1.730104 | 0.8650519 | 92.38754 | 5.017301 |
| Muslim (Islam) | 8.333333 | 3.7037037 | 42.59259 | 45.370370 |
| Nothing in particular | 4.584626 | 5.4119269 | 41.84764 | 48.155808 |
| Orthodox (Greek, Russian, or some other orthodox church) | 6.936416 | 6.6473988 | 49.42197 | 36.994220 |
| Protestant | 4.188395 | 3.2841451 | 73.97648 | 18.550982 |
| Roman Catholic | 4.210258 | 4.0316407 | 64.53177 | 27.226333 |
| Unitarian (Universalist) (VOL) | 9.523810 | 6.3492063 | 23.01587 | 61.111111 |
Conclusion:
The data underscores the diversity of beliefs regarding the nature of God among individuals who identify with various religious traditions. While many perceive God as a personal entity, others conceptualize God as an impersonal force or hold alternative views. Understanding these diverse conceptions enriches our insight into the complex and multifaceted nature of religious beliefs across different faith communities.
Women demonstrate a significantly higher inclination than men to express absolute certainty in their belief in a personal God (81% vs. 72%).
God_belief_gender <- survey_data_2007 %>%
filter(q30 == 'Yes') %>%
group_by(sex) %>%
filter(n() > 100) %>% # Keep only religions with more than 100 respondents
ungroup() %>%
filter(!is.na(sex), !is.na(q31)) %>% # Ensure q16 and q31 are not NA
group_by(sex, q31) %>%
summarise(Count = n(), .groups = 'drop') %>% # Count occurrences and drop grouping
ungroup() %>%
group_by(sex) %>%
mutate(Total = sum(Count),
Percentage = (Count / Total) * 100) %>%
ungroup() %>%
arrange(sex, q31)
God_belief_gender_selected <- select(God_belief_gender, sex, q31, Percentage)
God_belief_gender_wide <- pivot_wider(
God_belief_gender_selected,
names_from = q31, # This column's unique values will become the names of the new columns
values_from = Percentage, # The cell values will come from the 'Percentage' column
values_fill = list(Percentage = 0) # Fill missing combinations with 0%
)
colnames(God_belief_gender_wide)[1] <- "Sex"
# Create the table with kable and add styling with kableExtra
table <- kable(God_belief_gender_wide, "html") %>%
kable_styling("striped", full_width = T) %>%
add_header_above(c(" " = 1, "Belief in God" = 4, " " = 1)) %>%
row_spec(0, bold = T, color = "white", background = "#636363") %>%
scroll_box( height = "100%") %>%
column_spec(1, bold = T)
# If you want to see the table in RStudio's Viewer
table| Sex | Absolutely certain | Don’t know/refused (VOL.) | Fairly certain | Not at all certain | Not too certain |
|---|---|---|---|---|---|
| Female | 81.99158 | 0.7104990 | 14.72919 | 0.5465377 | 2.022189 |
| Male | 72.96798 | 0.7594417 | 21.35331 | 1.1904762 | 3.728790 |
Furthermore, older Americans are notably more likely than younger Americans to profess certain belief in a personal God. Among individuals aged 60 and above, almost eight-in-ten (81%) express this conviction, in contrast with (70%) of those under the age of 30.
God_belief_age <- filtered_data_age %>%
filter(q30 == 'Yes') %>%
group_by(sex) %>%
filter(n() > 100) %>% # Keep only religions with more than 100 respondents
ungroup() %>%
filter(!is.na(AgeGroup), !is.na(q31)) %>% # Ensure q16 and q31 are not NA
group_by(AgeGroup, q31) %>%
summarise(Count = n(), .groups = 'drop') %>% # Count occurrences and drop grouping
ungroup() %>%
group_by(AgeGroup) %>%
mutate(Total = sum(Count),
Percentage = (Count / Total) * 100) %>%
ungroup() %>%
arrange(AgeGroup, q31)
God_belief_age_selected <- select(God_belief_age, AgeGroup, q31, Percentage)
God_belief_age_wide <- pivot_wider(
God_belief_age_selected,
names_from = q31, # This column's unique values will become the names of the new columns
values_from = Percentage, # The cell values will come from the 'Percentage' column
values_fill = list(Percentage = 0) # Fill missing combinations with 0%
)
colnames(God_belief_age_wide)[1] <- "AgeGroup"
# Create the table with kable and add styling with kableExtra
table <- kable(God_belief_age_wide, "html") %>%
kable_styling("striped", full_width = T) %>%
add_header_above(c(" " = 1, "Belief in God" = 4, " " = 1)) %>%
row_spec(0, bold = T, color = "white", background = "#636363") %>%
scroll_box( height = "100%") %>%
column_spec(1, bold = T)
# If you want to see the table in RStudio's Viewer
table| AgeGroup | Absolutely certain | Don’t know/refused (VOL.) | Fairly certain | Not at all certain | Not too certain |
|---|---|---|---|---|---|
| 10-20 | 69.57041 | 0.4773270 | 24.70167 | 1.1933174 | 4.057279 |
| 20-30 | 71.78884 | 0.5379960 | 22.86483 | 0.7733692 | 4.034970 |
| 30-40 | 75.30416 | 0.2774813 | 20.57631 | 0.8324440 | 3.009605 |
| 40-50 | 78.99427 | 0.4296626 | 17.23425 | 0.7638447 | 2.577976 |
| 50-60 | 77.52907 | 0.6395349 | 18.21221 | 0.8139535 | 2.805233 |
| 60-70 | 80.54747 | 0.7377208 | 15.41448 | 0.8542031 | 2.446127 |
| 70-80 | 82.28719 | 1.2611063 | 13.47091 | 0.9458298 | 2.034967 |
| 80+ | 79.96760 | 2.1058315 | 14.20086 | 0.8639309 | 2.861771 |
In general, Americans with a college education tend to be slightly less inclined to believe with certainty in a personal God compared to those without a degree.
God_belief_edu <- survey_data_2007 %>%
group_by(educ) %>%
filter(n() > 100) %>% # Keep only religions with more than 100 respondents
ungroup() %>%
filter(!is.na(educ), !is.na(q21)) %>% # Ensure q16 and q21 are not NA
group_by(educ, q21) %>%
summarise(Count = n(), .groups = 'drop') %>% # Count occurrences and drop grouping
ungroup() %>%
group_by(educ) %>%
mutate(Total = sum(Count),
Percentage = (Count / Total) * 100) %>%
ungroup() %>%
arrange(educ, q21)
God_belief_edu_selected <- select(God_belief_edu, educ, q21, Percentage)
God_belief_edu_wide <- pivot_wider(
God_belief_edu_selected,
names_from = q21, # This column's unique values will become the names of the new columns
values_from = Percentage, # The cell values will come from the 'Percentage' column
values_fill = list(Percentage = 0) # Fill missing combinations with 0%
)
colnames(God_belief_edu_wide)[1] <- "Education"
# Create the table with kable and add styling with kableExtra
table <- kable(God_belief_edu_wide, "html") %>%
kable_styling("striped", full_width = T) %>%
add_header_above(c(" " = 1, "How important is religion in your life" = 4, " " = 1)) %>%
row_spec(0, bold = T, color = "white", background = "#636363") %>%
scroll_box( height = "100%") %>%
column_spec(1, bold = T)
# If you want to see the table in RStudio's Viewer
table| Education | Don’t know/Refused (VOL.) | Not at all important | Not too important | Somewhat important | Very important |
|---|---|---|---|---|---|
| College graduate (B.S., B.A., or other 4-year degree) | 0.7468658 | 8.015471 | 10.576154 | 26.79381 | 53.86770 |
| Don’t know/Refused (VOL.) | 8.9147287 | 4.263566 | 6.589147 | 23.25581 | 56.97674 |
| High school graduate (Grade 12 or GED certificate) | 0.7780922 | 5.254648 | 7.225142 | 26.35408 | 60.38804 |
| High school incomplete (Grades 9-11) | 1.2385321 | 4.724771 | 6.422018 | 22.98165 | 64.63303 |
| None, or grade 1-8 | 1.7957351 | 3.030303 | 3.815937 | 16.94725 | 74.41077 |
| Post-graduate training or professional schooling after colle | 0.8466777 | 10.914780 | 11.522179 | 25.28990 | 51.42647 |
| Some college, no 4-year degree (including associate degree) | 0.9368244 | 6.665866 | 8.527504 | 26.00288 | 57.86692 |
| Technical, trade, or vocational school AFTER high school | 1.1173184 | 5.400372 | 7.355680 | 20.85661 | 65.27002 |
The data presents varying levels of certainty among individuals from different religious backgrounds regarding the existence of life after death:
Absolutely Certain: A substantial proportion of respondents across several religious affiliations express absolute certainty about life after death. This belief is particularly strong among Mormons (90.86%), Jehovah’s Witnesses (88.89%), and Muslims (86.36%).
Fairly Certain: Many respondents indicate a high degree of confidence, albeit not absolute certainty, in the existence of life after death. This sentiment is prevalent among Christians (Protestants: 76.48%, Christians: 73.73%, Catholics: 61.05%) and members of other religious groups.
Uncertainty: Some respondents express varying degrees of uncertainty regarding life after death. This uncertainty is evident across different religious affiliations, with notable proportions of individuals falling into categories such as “Don’t know/refused” or “Not at all certain.”
Afterlife_belief <- survey_data_2007 %>%
filter(q33 == 'Yes') %>%
group_by(q16) %>%
filter(n() > 50) %>% # Keep only religions with more than 100 respondents
ungroup() %>%
filter(!is.na(q16), !is.na(q34)) %>% # Ensure q16 and q21 are not NA
group_by(q16, q34) %>%
summarise(Count = n(), .groups = 'drop') %>% # Count occurrences and drop grouping
ungroup() %>%
group_by(q16) %>%
mutate(Total = sum(Count),
Percentage = (Count / Total) * 100) %>%
ungroup() %>%
arrange(q16, q34)
Afterlife_belief_selected <- select(Afterlife_belief, q16, q34, Percentage)
Afterlife_belief_wide <- pivot_wider(
Afterlife_belief_selected,
names_from = q34, # This column's unique values will become the names of the new columns
values_from = Percentage, # The cell values will come from the 'Percentage' column
values_fill = list(Percentage = 0) # Fill missing combinations with 0%
)
colnames(Afterlife_belief_wide)[1] <- "Religion"
# Create the table with kable and add styling with kableExtra
table <- kable(Afterlife_belief_wide, "html") %>%
kable_styling("striped", full_width = T) %>%
add_header_above(c(" " = 1, "Life After Death" = 4, " " = 1)) %>%
row_spec(0, bold = T, color = "white", background = "#636363") %>%
scroll_box( height = "100%") %>%
column_spec(1, bold = T)
table| Religion | Absolutely certain | Don’t know/refused (VOL.) | Fairly certain | Not at all certain | Not too certain |
|---|---|---|---|---|---|
| Agnostic (not sure if there is a God) | 34.70149 | 0.7462687 | 37.686567 | 8.5820896 | 18.283582 |
| Atheist (do not believe in God) | 32.91139 | 2.5316456 | 43.037975 | 2.5316456 | 18.987342 |
| Buddhist | 47.77778 | 1.8518519 | 38.518518 | 2.9629630 | 8.888889 |
| Christian (VOL) | 73.73272 | 1.8433180 | 19.815668 | 1.3824885 | 3.225807 |
| Don’t know/Refused (VOL) | 52.52525 | 3.0303030 | 32.323232 | 4.0404040 | 8.080808 |
| Hindu | 50.60976 | 0.6097561 | 32.926829 | 4.2682927 | 11.585366 |
| Jehovah’s Witness (VOL) | 88.88889 | 1.1111111 | 6.666667 | 0.0000000 | 3.333333 |
| Jewish (Judaism) | 42.17391 | 0.8695652 | 37.826087 | 6.0869565 | 13.043478 |
| Mormon (Church of Jesus Christ of Latter-day Saints/LDS) | 90.86116 | 0.0000000 | 7.557118 | 0.0000000 | 1.581722 |
| Muslim (Islam) | 86.36364 | 1.1363636 | 9.090909 | 2.2727273 | 1.136364 |
| Nothing in particular | 46.72173 | 1.1874032 | 38.461539 | 2.3748064 | 11.254517 |
| Orthodox (Greek, Russian, or some other orthodox church) | 63.11787 | 0.7604563 | 31.178707 | 1.1406844 | 3.802281 |
| Protestant | 76.47719 | 0.6271869 | 19.654057 | 0.5017495 | 2.739816 |
| Roman Catholic | 61.05181 | 0.8634223 | 31.632653 | 0.8320251 | 5.620094 |
| Unitarian (Universalist) (VOL) | 41.42857 | 1.4285714 | 47.142857 | 1.4285714 | 8.571429 |
Conclusion:
The data highlights the diversity of beliefs concerning life after death among individuals from various religious traditions. While some express unwavering certainty, others hold more nuanced or uncertain perspectives. Understanding these diverse beliefs provides valuable insight into the complex and multifaceted nature of religious beliefs surrounding the concept of life after death.
Belief in Heaven Across Different Religious Affiliations:
The data reflects the varying degrees of belief in heaven among individuals from diverse religious backgrounds:
High Belief: A significant proportion of respondents across several religious groups express a strong belief in heaven. This belief is particularly prominent among Mormons (94.84%), Muslims (83.62%), and Protestants (81.96%).
Moderate Belief: Some respondents exhibit a moderate level of belief in heaven. This category includes individuals from Orthodox Christian traditions (71.90%) and various Christian denominations.
Low Belief: Certain religious affiliations demonstrate lower levels of belief in heaven compared to others. For instance, Buddhists (29.68%) and individuals identifying with “Nothing in particular” (45.40%) exhibit lower rates of belief in heaven.
Uncertainty: A minority of respondents either express uncertainty about their belief in heaven or refrain from providing a clear response (“Don’t know/refused” category). This uncertainty is relatively low across most religious affiliations but is more pronounced among some groups like Jews (13.20%) and Atheists (3.50%).
Heaven_belief <- survey_data_2007 %>%
group_by(q16) %>%
filter(n() > 100) %>% # Keep only religions with more than 100 respondents
ungroup() %>%
filter(!is.na(q16), !is.na(q35)) %>% # Ensure q16 and q21 are not NA
group_by(q16, q35) %>%
summarise(Count = n(), .groups = 'drop') %>% # Count occurrences and drop grouping
ungroup() %>%
group_by(q16) %>%
mutate(Total = sum(Count),
Percentage = (Count / Total) * 100) %>%
ungroup() %>%
arrange(q16, q35)
Heaven_belief_selected <- select(Heaven_belief, q16, q35, Percentage)
Heaven_belief_wide <- pivot_wider(
Heaven_belief_selected,
names_from = q35, # This column's unique values will become the names of the new columns
values_from = Percentage, # The cell values will come from the 'Percentage' column
values_fill = list(Percentage = 0) # Fill missing combinations with 0%
)
colnames(Heaven_belief_wide)[1] <- "Religion"
# Create the table with kable and add styling with kableExtra
table_Heaven <- kable(Heaven_belief_wide, "html") %>%
kable_styling("striped", full_width = T) %>%
add_header_above(c(" " = 1, "Belief in Heaven" = 3, " " = 1)) %>%
row_spec(0, bold = T, color = "white", background = "#636363") %>%
scroll_box( height = "100%") %>%
column_spec(1, bold = T)
# If you want to see the table in RStudio's Viewer
table_Heaven| Religion | Don’t know/refused (VOL.) | No | Other (VOL.) | Yes |
|---|---|---|---|---|
| Agnostic (not sure if there is a God) | 11.743341 | 70.096852 | 2.663438 | 15.49637 |
| Atheist (do not believe in God) | 3.495146 | 85.242718 | 0.776699 | 10.48544 |
| Buddhist | 7.542579 | 59.854015 | 2.919708 | 29.68370 |
| Christian (VOL) | 8.561644 | 14.554794 | 5.308219 | 71.57534 |
| Don’t know/Refused (VOL) | 29.600000 | 38.800000 | 3.200000 | 28.40000 |
| Hindu | 10.894942 | 37.743191 | 3.112840 | 48.24903 |
| Jehovah’s Witness (VOL) | 3.755869 | 39.906103 | 9.389671 | 46.94836 |
| Jewish (Judaism) | 13.196481 | 52.346041 | 1.612903 | 32.84457 |
| Mormon (Church of Jesus Christ of Latter-day Saints/LDS) | 1.721170 | 2.409639 | 1.032702 | 94.83649 |
| Muslim (Islam) | 1.724138 | 12.068965 | 2.586207 | 83.62069 |
| Nothing in particular | 10.925277 | 41.111411 | 2.562719 | 45.40059 |
| Orthodox (Greek, Russian, or some other orthodox church) | 7.162534 | 17.630854 | 3.305785 | 71.90083 |
| Protestant | 4.860241 | 8.592601 | 4.587806 | 81.95935 |
| Roman Catholic | 5.654281 | 9.432087 | 1.851622 | 83.06201 |
| Unitarian (Universalist) (VOL) | 8.441558 | 72.727273 | 3.246753 | 15.58442 |
Hell_belief <- survey_data_2007 %>%
group_by(q16) %>%
filter(n() > 100) %>% # Keep only religions with more than 100 respondents
ungroup() %>%
filter(!is.na(q16), !is.na(q36)) %>% # Ensure q16 and q21 are not NA
group_by(q16, q36) %>%
summarise(Count = n(), .groups = 'drop') %>% # Count occurrences and drop grouping
ungroup() %>%
group_by(q16) %>%
mutate(Total = sum(Count),
Percentage = (Count / Total) * 100) %>%
ungroup() %>%
arrange(q16, q36)
Hell_belief_selected <- select(Hell_belief, q16, q36, Percentage)
Hell_belief_wide <- pivot_wider(
Hell_belief_selected,
names_from = q36, # This column's unique values will become the names of the new columns
values_from = Percentage, # The cell values will come from the 'Percentage' column
values_fill = list(Percentage = 0) # Fill missing combinations with 0%
)
colnames(Hell_belief_wide)[1] <- "Religion"
# Create the table with kable and add styling with kableExtra
table_Hell <- kable(Hell_belief_wide, "html") %>%
kable_styling("striped", full_width = T) %>%
add_header_above(c(" " = 1, "Belief in Hell" = 3, " " = 1)) %>%
row_spec(0, bold = T, color = "white", background = "#636363") %>%
scroll_box( height = "100%") %>%
column_spec(1, bold = T)
# If you want to see the table in RStudio's Viewer
table_Hell| Religion | Don’t know/refused (VOL.) | No | Other (VOL.) | Yes |
|---|---|---|---|---|
| Agnostic (not sure if there is a God) | 9.685230 | 78.32930 | 2.1791768 | 9.806295 |
| Atheist (do not believe in God) | 2.912621 | 87.37864 | 0.9708738 | 8.737864 |
| Buddhist | 7.055961 | 70.31630 | 2.1897810 | 20.437956 |
| Christian (VOL) | 10.102740 | 27.91096 | 4.4520548 | 57.534247 |
| Don’t know/Refused (VOL) | 28.800000 | 49.20000 | 4.4000000 | 17.600000 |
| Hindu | 11.673152 | 50.19455 | 3.5019455 | 34.630350 |
| Jehovah’s Witness (VOL) | 1.408451 | 87.79343 | 1.8779343 | 8.920188 |
| Jewish (Judaism) | 9.237537 | 72.87390 | 0.8797654 | 17.008798 |
| Mormon (Church of Jesus Christ of Latter-day Saints/LDS) | 5.163511 | 29.43201 | 8.7779690 | 56.626506 |
| Muslim (Islam) | 3.448276 | 12.93103 | 5.1724138 | 78.448276 |
| Nothing in particular | 9.630429 | 55.48961 | 2.1850553 | 32.694902 |
| Orthodox (Greek, Russian, or some other orthodox church) | 12.672176 | 30.30303 | 3.5812672 | 53.443526 |
| Protestant | 7.769847 | 18.60186 | 3.2801177 | 70.348172 |
| Roman Catholic | 10.190133 | 27.22754 | 2.8209271 | 59.761402 |
| Unitarian (Universalist) (VOL) | 3.896104 | 88.96104 | 1.9480519 | 5.194805 |
Belief in Hell Across Different Religious Affiliations:
The dataset reveals a spectrum of beliefs regarding the concept of hell among individuals from various religious backgrounds:
Strong Belief: A substantial proportion of respondents, particularly from Christian denominations like Jehovah’s Witnesses (8.92%) and Mormons (56.63%), express a strong belief in hell. This belief is also prevalent among Muslims (78.45%) and certain Protestant groups (70.35%).
Moderate Belief: Some respondents demonstrate a moderate level of belief in hell, including individuals from Orthodox Christian traditions (53.44%) and Roman Catholics (59.76%).
Low Belief: Certain religious affiliations exhibit lower levels of belief in hell compared to others. For instance, Buddhists (20.44%) and individuals identifying with “Nothing in particular” (32.69%) show lower rates of belief in hell.
Uncertainty: A minority of respondents express uncertainty about their belief in hell or decline to provide a clear response (“Don’t know/refused” category). This uncertainty is relatively low across most religious affiliations but is more pronounced among some groups like Jews (9.24%) and Atheists (2.91%).
Combined_Heaven_Hell_wide = bind_cols (Heaven_belief_wide$Religion , Heaven_belief_wide$Yes , Hell_belief_wide$Yes)## New names:
## • `` -> `...1`
## • `` -> `...2`
## • `` -> `...3`
colnames(Combined_Heaven_Hell_wide)[1] <- "Religion"
colnames(Combined_Heaven_Hell_wide)[2] <- "Heaven"
colnames(Combined_Heaven_Hell_wide)[3] <- "Hell"
# Reshape the data to a long format
long_data <- pivot_longer(
Combined_Heaven_Hell_wide,
cols = c("Heaven", "Hell"),
names_to = "Belief",
values_to = "Percentage"
)
# Create the bar plot
p <- ggplot(long_data, aes(x = Religion, y = Percentage, fill = Belief)) +
geom_bar(stat = "identity", position = position_dodge(width = 0.7)) +
labs(title = "Percentage of People Believing in Heaven and Hell by Religion",
x = "Religion",
y = "Percentage",
fill = "Belief") +
theme_minimal() +
theme(axis.text.x = element_text(angle = 45, vjust = 1, hjust=1),
legend.position = "bottom")
# Make it interactive
interactive_plot <- ggplotly(p , width = 1200 , height = 700)
# Show the interactive plot in your default browser
interactive_plotBelief in the Occurrence of Miracles Today:
The survey data provides insights into the beliefs regarding the occurrence of miracles in contemporary times compared to ancient eras among individuals from various religious backgrounds:
Strong Belief: A significant proportion of respondents from the Mormon Church (LDS) (79.17%), Protestant denominations (53.26%), and certain Christian denominations (52.05% to 46.80%) express strong agreement that miracles still occur today, akin to ancient times. This belief is notably high among Mormons, indicating a firm conviction in the continued manifestation of miracles.
Moderate Belief: Some respondents, particularly from Orthodox Christian traditions (41.87%), Islam (39.66%), and Hinduism (24.12%), express a moderate level of agreement with the notion that miracles still happen today. While not as pronounced as in the aforementioned groups, this belief remains notable within these religious affiliations.
Uncertainty: A portion of respondents either express uncertainty about the occurrence of miracles in contemporary times or decline to provide a definitive stance (“Don’t know/refused” category). This uncertainty varies across religious affiliations but is particularly notable among Atheists (61.75%) and individuals identifying with “Nothing in particular” (17.80%).
Disagreement: Certain respondents, including Atheists, Agnostics, and individuals from Jewish, Unitarian Universalist, and certain Christian denominations, express either complete disagreement or a majority disagreement with the idea that miracles still occur today as they did in ancient times.
Miracle_belief <- survey_data_2007 %>%
group_by(q16) %>%
filter(n() > 100) %>% # Keep only religions with more than 100 respondents
ungroup() %>%
filter(!is.na(q16), !is.na(q39a)) %>% # Ensure q16 and q39b are not NA
group_by(q16, q39a) %>%
summarise(Count = n(), .groups = 'drop') %>% # Count occurrences and drop grouping
ungroup() %>%
group_by(q16) %>%
mutate(Total = sum(Count),
Percentage = (Count / Total) * 100) %>%
ungroup() %>%
arrange(q16, q39a)
Miracle_belief_selected <- select(Miracle_belief, q16, q39a, Percentage)
Miracle_belief_wide <- pivot_wider(
Miracle_belief_selected,
names_from = q39a, # This column's unique values will become the names of the new columns
values_from = Percentage, # The cell values will come from the 'Percentage' column
values_fill = list(Percentage = 0) # Fill missing combinations with 0%
)
colnames(Miracle_belief_wide)[1] <- "Religion"
# Create the table with kable and add styling with kableExtra
table_Miracle <- kable(Miracle_belief_wide, "html") %>%
kable_styling("striped", full_width = T) %>%
add_header_above(c(" " = 1, "Question: Miracles still occur today as in ancient times" = 4, " " = 1)) %>%
row_spec(0, bold = T, color = "white", background = "#636363") %>%
scroll_box( height = "100%") %>%
column_spec(1, bold = T)
# If you want to see the table in RStudio's Viewer
table_Miracle| Religion | Completely agree | Completely disagree | Don’t know/refused (VOL.) | Mostly agree | Mostly disagree |
|---|---|---|---|---|---|
| Agnostic (not sure if there is a God) | 13.075060 | 36.3196126 | 4.6004843 | 21.428571 | 24.576271 |
| Atheist (do not believe in God) | 9.514563 | 61.7475728 | 3.8834951 | 9.126214 | 15.728155 |
| Buddhist | 30.170316 | 16.7883212 | 5.3527981 | 28.953771 | 18.734793 |
| Christian (VOL) | 52.054794 | 5.6506849 | 5.9931507 | 28.938356 | 7.363014 |
| Don’t know/Refused (VOL) | 22.400000 | 16.8000000 | 22.4000000 | 24.000000 | 14.400000 |
| Hindu | 24.124514 | 12.4513619 | 4.6692607 | 43.579766 | 15.175097 |
| Jehovah’s Witness (VOL) | 14.084507 | 46.4788732 | 5.1643192 | 15.492958 | 18.779343 |
| Jewish (Judaism) | 18.768328 | 24.6334311 | 6.1583578 | 29.618768 | 20.821114 |
| Mormon (Church of Jesus Christ of Latter-day Saints/LDS) | 79.173838 | 0.8605852 | 0.3442341 | 17.383821 | 2.237522 |
| Muslim (Islam) | 39.655172 | 12.9310345 | 6.0344828 | 27.586207 | 13.793103 |
| Nothing in particular | 27.569463 | 17.8041543 | 4.5049906 | 32.560022 | 17.561370 |
| Orthodox (Greek, Russian, or some other orthodox church) | 41.873278 | 8.5399449 | 2.7548209 | 36.639119 | 10.192837 |
| Protestant | 53.261047 | 3.8304364 | 2.7352476 | 32.163679 | 8.009590 |
| Roman Catholic | 46.800050 | 4.2127501 | 2.9824779 | 36.858457 | 9.146266 |
| Unitarian (Universalist) (VOL) | 14.935065 | 23.3766234 | 5.1948052 | 36.363636 | 20.129870 |
Similarly, about two-thirds of U.S. adults (68%) believe in the activity of angels and demons in the world. This belief is especially common among members of Christian traditions, including approximately nine-in-ten members of evangelical Protestant churches, Jehovah’s Witnesses, and Mormons.
DEMON_belief <- survey_data_2007 %>%
group_by(q16) %>%
filter(n() > 100) %>% # Keep only religions with more than 100 respondents
ungroup() %>%
filter(!is.na(q16), !is.na(q39b)) %>% # Ensure q16 and q21 are not NA
group_by(q16, q39b) %>%
summarise(Count = n(), .groups = 'drop') %>% # Count occurrences and drop grouping
ungroup() %>%
group_by(q16) %>%
mutate(Total = sum(Count),
Percentage = (Count / Total) * 100) %>%
ungroup() %>%
arrange(q16, q39b)
DEMON_belief_selected <- select(DEMON_belief, q16, q39b, Percentage)
DEMON_belief_wide <- pivot_wider(
DEMON_belief_selected,
names_from = q39b, # This column's unique values will become the names of the new columns
values_from = Percentage, # The cell values will come from the 'Percentage' column
values_fill = list(Percentage = 0) # Fill missing combinations with 0%
)
colnames(DEMON_belief_wide)[1] <- "Religion"
# Create the table with kable and add styling with kableExtra
table_Demon <- kable(DEMON_belief_wide, "html") %>%
kable_styling("striped", full_width = T) %>%
add_header_above(c(" " = 1, "Question: Angels and demons are active in the world" = 4, " " = 1)) %>%
row_spec(0, bold = T, color = "white", background = "#636363") %>%
scroll_box( height = "100%") %>%
column_spec(1, bold = T)
# If you want to see the table in RStudio's Viewer
table_Demon| Religion | Completely agree | Completely disagree | Don’t know/refused (VOL.) | Mostly agree | Mostly disagree |
|---|---|---|---|---|---|
| Agnostic (not sure if there is a God) | 6.416465 | 55.690073 | 3.3898305 | 11.016949 | 23.4866828 |
| Atheist (do not believe in God) | 5.242718 | 76.893204 | 3.3009709 | 6.407767 | 8.1553398 |
| Buddhist | 12.165450 | 35.766423 | 6.3260341 | 22.627737 | 23.1143552 |
| Christian (VOL) | 44.863014 | 8.219178 | 9.7602740 | 27.568493 | 9.5890411 |
| Don’t know/Refused (VOL) | 16.800000 | 28.000000 | 25.2000000 | 13.600000 | 16.4000000 |
| Hindu | 15.175097 | 35.019455 | 7.7821012 | 19.455253 | 22.5680934 |
| Jehovah’s Witness (VOL) | 78.873239 | 2.816901 | 0.9389671 | 16.901408 | 0.4694836 |
| Jewish (Judaism) | 7.478006 | 54.692082 | 7.0381232 | 10.703812 | 20.0879765 |
| Mormon (Church of Jesus Christ of Latter-day Saints/LDS) | 58.864027 | 3.270224 | 3.7865749 | 29.948365 | 4.1308090 |
| Muslim (Islam) | 45.689655 | 6.034483 | 8.6206897 | 31.034483 | 8.6206897 |
| Nothing in particular | 19.800378 | 29.646614 | 6.4472619 | 24.089560 | 20.0161856 |
| Orthodox (Greek, Russian, or some other orthodox church) | 32.231405 | 13.774105 | 5.5096419 | 32.231405 | 16.2534435 |
| Protestant | 48.329973 | 7.350297 | 4.6749850 | 29.014330 | 10.6304146 |
| Roman Catholic | 33.962968 | 10.289549 | 5.7909780 | 34.708587 | 15.2479185 |
| Unitarian (Universalist) (VOL) | 5.844156 | 52.597403 | 5.8441558 | 10.389610 | 25.3246753 |
In contrast, belief in the activity of angels and demons is less common among Buddhists and Hindus, as well as among Jews. While relatively few atheists and agnostics hold this belief.
The data illustrates diverse patterns of attendance across different religious groups. For instance, some groups show higher rates of frequent attendance, such as Jehovah’s Witnesses and Mormons, with a significant proportion attending religious services several times a day. Within the Christian category, there’s notable variation in attendance habits. For example, while a considerable portion of Roman Catholics attend services a few times a week or more, Protestant attendees tend to spread more evenly across different levels of attendance frequency.
Worship_frequency <- survey_data_2007 %>%
group_by(q16) %>%
filter(n() > 100) %>% # Keep only religions with more than 100 respondents
ungroup() %>%
filter(!is.na(q16), !is.na(q41)) %>% # Ensure q16 and q41 are not NA
group_by(q16, q41) %>%
summarise(Count = n(), .groups = 'drop') %>% # Count occurrences and drop grouping
ungroup() %>%
group_by(q16) %>%
mutate(Total = sum(Count),
Percentage = (Count / Total) * 100) %>%
ungroup() %>%
arrange(q16, q41)
Worship_frequency_selected <- select(Worship_frequency, q16, q41, Percentage)
Worship_frequency_wide <- pivot_wider(
Worship_frequency_selected,
names_from = q41, # This column's unique values will become the names of the new columns
values_from = Percentage, # The cell values will come from the 'Percentage' column
values_fill = list(Percentage = 0) # Fill missing combinations with 0%
)
colnames(Worship_frequency_wide)[1] <- "Religion"
# Create the table with kable and add styling with kableExtra
table <- kable(Worship_frequency_wide, "html") %>%
kable_styling("striped", full_width = T) %>%
add_header_above(c(" " = 1, "Attendance at Religious Services" = 7, " " = 1)) %>%
row_spec(0, bold = T, color = "white", background = "#636363") %>%
scroll_box( height = "100%") %>%
column_spec(1, bold = T)
# If you want to see the table in RStudio's Viewer
table| Religion | A few times a month | A few times a week | Don’t know/Refused (VOL.) | Never | Once a day | Once a week | Seldom | Several times a day |
|---|---|---|---|---|---|---|---|---|
| Agnostic (not sure if there is a God) | 6.537530 | 6.295400 | 0.3631961 | 44.4309927 | 3.631961 | 1.8159806 | 30.871671 | 6.053269 |
| Atheist (do not believe in God) | 1.553398 | 2.330097 | 2.1359223 | 79.2233010 | 2.330097 | 1.5533981 | 8.737864 | 2.135922 |
| Buddhist | 8.272506 | 10.948905 | 1.4598540 | 15.3284672 | 19.221411 | 1.9464720 | 15.328467 | 27.493917 |
| Christian (VOL) | 3.767123 | 14.212329 | 6.6780822 | 2.5684932 | 18.664384 | 1.3698630 | 7.191781 | 45.547945 |
| Don’t know/Refused (VOL) | 4.400000 | 7.600000 | 20.0000000 | 19.2000000 | 9.200000 | 1.2000000 | 20.800000 | 17.600000 |
| Hindu | 5.058366 | 10.894942 | 1.9455253 | 4.6692607 | 36.186770 | 3.1128405 | 12.840467 | 25.291829 |
| Jehovah’s Witness (VOL) | 1.877934 | 5.164319 | 0.4694836 | 0.4694836 | 9.859155 | 0.4694836 | 1.408451 | 80.281690 |
| Jewish (Judaism) | 8.357771 | 13.196481 | 3.5190616 | 18.0351906 | 12.023460 | 4.5454545 | 27.712610 | 12.609971 |
| Mormon (Church of Jesus Christ of Latter-day Saints/LDS) | 2.753873 | 6.884682 | 0.6884682 | 0.3442341 | 16.006885 | 1.2048193 | 4.130809 | 67.986231 |
| Muslim (Islam) | 0.862069 | 6.034483 | 0.8620690 | 7.7586207 | 5.172414 | 2.5862069 | 8.620690 | 68.103448 |
| Nothing in particular | 7.661181 | 11.788508 | 2.1041273 | 24.2514162 | 11.087132 | 2.1580793 | 24.925816 | 16.023739 |
| Orthodox (Greek, Russian, or some other orthodox church) | 5.234160 | 15.151515 | 1.9283747 | 4.1322314 | 26.997245 | 3.0303030 | 11.570248 | 31.955923 |
| Protestant | 4.380755 | 14.166621 | 1.3839699 | 1.4602517 | 21.500572 | 2.1631341 | 6.195172 | 48.749523 |
| Roman Catholic | 6.288058 | 16.751584 | 1.1805642 | 2.3984093 | 25.599602 | 3.6908165 | 9.282963 | 34.808003 |
| Unitarian (Universalist) (VOL) | 4.545454 | 11.038961 | 3.2467532 | 22.0779221 | 14.935065 | 5.1948052 | 18.831169 | 20.129870 |
Atheists and agnostics exhibit lower rates of religious service attendance compared to religious groups. The majority of respondents in these categories report never attending religious services, with atheists (79.2%) and agnostics (44.4%) being the highest in this regard.Those who identify as having “nothing in particular” also show varied attendance patterns, with a significant proportion reporting infrequent or no attendance. Specifically, 24.3% report never attending religious services..Minority religious groups such as Buddhists, Hindus, Muslims, and Jews display diverse attendance patterns, with some members attending services frequently while others rarely do. For example, among Muslims, 68.1% report attending services several times a day, while among Jews, 27.7% attend services a few times a week or more.
Overall, nearly two-thirds of adults (63%) who have children under age 18 living at home say they pray or read Scripture with their children. Mormons (91%) are especially likely to do this. Roughly eight-in-ten members of protestan (81%) and historically black (77%) churches also pray or read Scripture with their children. Jews (41%), Buddhists (37%) and the unaffiliated (31%) are much less likely to pray or read Scripture with their children compared with members of many other religious traditions. But there are major differences within the unaffiliated group; a majority of the religious unaffiliated (52%) pray or read Scripture with their children, compared with only 16% of the secular unaffiliated, 19% of agnostics and 8% of atheists. Similar patterns are seen in parents’ decisions about sending their children to Sunday school or other religious education programs. Six-in-ten Americans with children under age 18 living at home arrange for them to attend such programs. Mormons (90%) stand out for their propensityto enroll their children in religious education, followed by members of evangelical (79%) and historically black (77%) churches. More than a third of the unaffiliated (35%) send their children to religious education programs, including a quarter of atheists (24%) and about half of the religious unaffiliated (49%). Among parents with children under age 18 living in their homes, 15% home-school their children or send them to a religious school instead of a public school. Jews (27%) and Orthodox Christians (30%) are most likely to do this.
Upbringing_children <- survey_data_2007 %>%
group_by(q16) %>%
filter(n() > 100) %>% # Keep only religions with more than 100 respondents
ungroup() %>%
filter(!is.na(q16), !is.na(q55a)) %>% # Ensure q16 and q41 are not NA
group_by(q16, q55a) %>%
summarise(Count = n(), .groups = 'drop') %>% # Count occurrences and drop grouping
ungroup() %>%
group_by(q16) %>%
mutate(Total = sum(Count),
Percentage = (Count / Total) * 100) %>%
ungroup() %>%
arrange(q16, q55a)
Upbringing_children_selected <- select(Upbringing_children, q16, q55a, Percentage)
Upbringing_children_wide <- pivot_wider(
Upbringing_children_selected,
names_from = q55a, # This column's unique values will become the names of the new columns
values_from = Percentage, # The cell values will come from the 'Percentage' column
values_fill = list(Percentage = 0) # Fill missing combinations with 0%
)
colnames(Upbringing_children_wide)[1] <- "Religion"
# Create the table with kable and add styling with kableExtra
table_1 <- kable(Upbringing_children_wide, "html") %>%
kable_styling("striped", full_width = T) %>%
add_header_above(c(" " = 1, "Send any of your children to Sunday school" = 2, " " = 1)) %>%
row_spec(0, bold = T, color = "white", background = "#636363") %>%
scroll_box( height = "100%") %>%
column_spec(1, bold = T)
# If you want to see the table in RStudio's Viewer
table_1| Religion | No | Yes | Don’t know/Refused (VOL.) |
|---|---|---|---|
| Agnostic (not sure if there is a God) | 81.025641 | 18.974359 | 0.0000000 |
| Atheist (do not believe in God) | 90.163934 | 7.377049 | 2.4590164 |
| Buddhist | 65.833333 | 34.166667 | 0.0000000 |
| Christian (VOL) | 28.947368 | 67.894737 | 3.1578947 |
| Don’t know/Refused (VOL) | 54.929578 | 36.619718 | 8.4507042 |
| Hindu | 34.375000 | 64.062500 | 1.5625000 |
| Jehovah’s Witness (VOL) | 13.888889 | 86.111111 | 0.0000000 |
| Jewish (Judaism) | 59.880240 | 40.119760 | 0.0000000 |
| Mormon (Church of Jesus Christ of Latter-day Saints/LDS) | 8.433735 | 91.566265 | 0.0000000 |
| Muslim (Islam) | 44.642857 | 55.357143 | 0.0000000 |
| Nothing in particular | 65.822785 | 33.502110 | 0.6751055 |
| Orthodox (Greek, Russian, or some other orthodox church) | 45.283019 | 54.716981 | 0.0000000 |
| Protestant | 25.134823 | 74.345146 | 0.5200308 |
| Roman Catholic | 36.720209 | 62.831528 | 0.4482630 |
| Unitarian (Universalist) (VOL) | 61.363636 | 38.636364 | 0.0000000 |
Upbringing_children_2 <- survey_data_2007 %>%
group_by(q16) %>%
filter(n() > 100) %>% # Keep only religions with more than 100 respondents
ungroup() %>%
filter(!is.na(q16), !is.na(q55b)) %>% # Ensure q16 and q41 are not NA
group_by(q16, q55b) %>%
summarise(Count = n(), .groups = 'drop') %>% # Count occurrences and drop grouping
ungroup() %>%
group_by(q16) %>%
mutate(Total = sum(Count),
Percentage = (Count / Total) * 100) %>%
ungroup() %>%
arrange(q16, q55b)
Upbringing_children_2_selected <- select(Upbringing_children_2, q16, q55b, Percentage)
Upbringing_children_2_wide <- pivot_wider(
Upbringing_children_2_selected,
names_from = q55b, # This column's unique values will become the names of the new columns
values_from = Percentage, # The cell values will come from the 'Percentage' column
values_fill = list(Percentage = 0) # Fill missing combinations with 0%
)
colnames(Upbringing_children_2_wide)[1] <- "Religion"
# Create the table with kable and add styling with kableExtra
table_2 <- kable(Upbringing_children_2_wide, "html") %>%
kable_styling("striped", full_width = T) %>%
add_header_above(c(" " = 1, "Pray or read the Scripture with your child" = 2, " " = 1)) %>%
row_spec(0, bold = T, color = "white", background = "#636363") %>%
scroll_box( height = "100%") %>%
column_spec(1, bold = T)
# If you want to see the table in RStudio's Viewer
table_2| Religion | No | Yes | Don’t know/Refused (VOL.) |
|---|---|---|---|
| Agnostic (not sure if there is a God) | 68.205128 | 31.79487 | 0.0000000 |
| Atheist (do not believe in God) | 72.950820 | 23.77049 | 3.2786885 |
| Buddhist | 72.500000 | 27.50000 | 0.0000000 |
| Christian (VOL) | 40.526316 | 57.36842 | 2.1052632 |
| Don’t know/Refused (VOL) | 57.746479 | 35.21127 | 7.0422535 |
| Hindu | 75.781250 | 21.87500 | 2.3437500 |
| Jehovah’s Witness (VOL) | 63.888889 | 34.72222 | 1.3888889 |
| Jewish (Judaism) | 43.113773 | 56.88623 | 0.0000000 |
| Mormon (Church of Jesus Christ of Latter-day Saints/LDS) | 8.835341 | 91.16466 | 0.0000000 |
| Muslim (Islam) | 58.928571 | 41.07143 | 0.0000000 |
| Nothing in particular | 62.278481 | 37.21519 | 0.5063291 |
| Orthodox (Greek, Russian, or some other orthodox church) | 39.622642 | 60.37736 | 0.0000000 |
| Protestant | 24.229584 | 75.28891 | 0.4815100 |
| Roman Catholic | 43.332088 | 56.10758 | 0.5603287 |
| Unitarian (Universalist) (VOL) | 36.363636 | 63.63636 | 0.0000000 |
Upbringing_children_3 <- survey_data_2007 %>%
group_by(q16) %>%
filter(n() > 100) %>% # Keep only religions with more than 100 respondents
ungroup() %>%
filter(!is.na(q16), !is.na(q55c)) %>% # Ensure q16 and q41 are not NA
group_by(q16, q55c) %>%
summarise(Count = n(), .groups = 'drop') %>% # Count occurrences and drop grouping
ungroup() %>%
group_by(q16) %>%
mutate(Total = sum(Count),
Percentage = (Count / Total) * 100) %>%
ungroup() %>%
arrange(q16, q55c)
Upbringing_children_3_selected <- select(Upbringing_children_3, q16, q55c, Percentage)
Upbringing_children_3_wide <- pivot_wider(
Upbringing_children_3_selected,
names_from = q55c, # This column's unique values will become the names of the new columns
values_from = Percentage, # The cell values will come from the 'Percentage' column
values_fill = list(Percentage = 0) # Fill missing combinations with 0%
)
colnames(Upbringing_children_3_wide)[1] <- "Religion"
# Create the table with kable and add styling with kableExtra
table_3 <- kable(Upbringing_children_3_wide, "html") %>%
kable_styling("striped", full_width = T) %>%
add_header_above(c(" " = 1, "Send your child/childern to religious school instead of a public school" = 2, " " = 1)) %>%
row_spec(0, bold = T, color = "white", background = "#636363") %>%
scroll_box( height = "100%") %>%
column_spec(1, bold = T)
# If you want to see the table in RStudio's Viewer
table_3| Religion | Don’t know/Refused (VOL.) | No | Yes |
|---|---|---|---|
| Agnostic (not sure if there is a God) | 0.5128205 | 90.76923 | 8.717949 |
| Atheist (do not believe in God) | 2.4590164 | 91.80328 | 5.737705 |
| Buddhist | 0.8333333 | 89.16667 | 10.000000 |
| Christian (VOL) | 2.1052632 | 81.57895 | 16.315790 |
| Don’t know/Refused (VOL) | 7.0422535 | 80.28169 | 12.676056 |
| Hindu | 1.5625000 | 93.75000 | 4.687500 |
| Jehovah’s Witness (VOL) | 1.3888889 | 84.72222 | 13.888889 |
| Jewish (Judaism) | 0.0000000 | 76.64671 | 23.353293 |
| Mormon (Church of Jesus Christ of Latter-day Saints/LDS) | 0.0000000 | 93.97590 | 6.024096 |
| Muslim (Islam) | 0.0000000 | 85.71429 | 14.285714 |
| Nothing in particular | 0.5907173 | 92.32068 | 7.088608 |
| Orthodox (Greek, Russian, or some other orthodox church) | 0.0000000 | 68.86792 | 31.132075 |
| Protestant | 0.8859784 | 83.82126 | 15.292758 |
| Roman Catholic | 0.7097497 | 77.54950 | 21.740755 |
| Unitarian (Universalist) (VOL) | 0.0000000 | 90.90909 | 9.090909 |
Combined_Upbringing_children_wide = bind_cols (Upbringing_children_wide$Religion , Upbringing_children_wide$Yes , Upbringing_children_2_wide$Yes , Upbringing_children_3_wide$Yes)## New names:
## • `` -> `...1`
## • `` -> `...2`
## • `` -> `...3`
## • `` -> `...4`
colnames(Combined_Upbringing_children_wide)[1] <- "Religion"
colnames(Combined_Upbringing_children_wide)[2] <- "Pray and read scripture"
colnames(Combined_Upbringing_children_wide)[3] <- "attend religious school on sunday"
colnames(Combined_Upbringing_children_wide)[4] <- "attend religious school instead of public school"
# Reshape the data to a long format
long_data <- pivot_longer(
Combined_Upbringing_children_wide,
cols = c("Pray and read scripture", "attend religious school on sunday","attend religious school instead of public school"),
names_to = "Belief",
values_to = "Percentage"
)
# Create the bar plot
p <- ggplot(long_data, aes(x = Religion, y = Percentage, fill = Belief)) +
geom_bar(stat = "identity", position = position_dodge(width = 0.7)) +
labs(title = "Percentage of People saying yes to the quesions",
x = "Religion",
y = "Percentage",
fill = "Belief") +
theme_minimal() +
theme(axis.text.x = element_text(angle = 45, vjust = 1, hjust=1),
legend.position = "bottom")
# Make it interactive
interactive_plot <- ggplotly(p , width = 1200 , height = 900)
# Show the interactive plot in your default browser
interactive_plotSimilar patterns are seen in parents’ decisions about sending their children to Sunday school or other religious education programs. Six-in-ten Americans with children under age 18 living at home arrange for them to attend such programs. Mormons (90%) stand out for their propensity to enroll their children in religious education. More than a third of the unaffiliated (35%) send their children to religious education programs, including a quarter of atheists (24%). Among parents with children under age 18 living in their homes, 15% home-school their children or send them to a religious school instead of a public school. Jews (27%) and Orthodox Christians (30%) are most likely to do this.
A majority of Americans (52%) report experiencing a sense of spiritual peace and well-being at least once a week. High rates of weekly spiritual peace are observed among Jehovah’s Witnesses and Mormons (77% and 71%, respectively), Muslims (64%). Conversely, Jews (38%) and the unaffiliated (35%) are among the groups least likely to experience spiritual peace on a weekly basis.
In contrast, a smaller proportion of Americans (39%) report feeling a deep sense of wonder about the universe on a weekly basis. Notably, over half of Buddhists (57%) and Muslims (53%) report experiencing this deep sense of wonder weekly, along with nearly half of Jehovah’s Witnesses (49%).
Peace_Wonder <- survey_data_2007 %>%
group_by(q16) %>%
filter(n() > 100) %>% # Keep only religions with more than 100 respondents
ungroup() %>%
filter(!is.na(q16), !is.na(q43a)) %>% # Ensure q16 and q43a are not NA
group_by(q16, q43a) %>%
summarise(Count = n(), .groups = 'drop') %>% # Count occurrences and drop grouping
ungroup() %>%
group_by(q16) %>%
mutate(Total = sum(Count),
Percentage = (Count / Total) * 100) %>%
ungroup() %>%
arrange(q16, q43a)
Peace_Wonder_selected <- select(Peace_Wonder, q16, q43a, Percentage)
Peace_Wonder_wide <- pivot_wider(
Peace_Wonder_selected,
names_from = q43a, # This column's unique values will become the names of the new columns
values_from = Percentage, # The cell values will come from the 'Percentage' column
values_fill = list(Percentage = 0) # Fill missing combinations with 0%
)
colnames(Peace_Wonder_wide)[1] <- "Religion"
# Create the table with kable and add styling with kableExtra
table <- kable(Peace_Wonder_wide, "html") %>%
kable_styling("striped", full_width = T) %>%
add_header_above(c(" " = 1, "feel a deep sense of spiritual peace and well-being" = 5, " " = 1)) %>%
row_spec(0, bold = T, color = "white", background = "#636363") %>%
scroll_box( height = "100%") %>%
column_spec(1, bold = T)
# If you want to see the table in RStudio's Viewer
table| Religion | At least once a week | Don’t know/Refused (VOL.) | Never | Once or twice a month | Seldom | Several times a year |
|---|---|---|---|---|---|---|
| Agnostic (not sure if there is a God) | 32.32446 | 3.510896 | 14.5278450 | 14.769976 | 20.217918 | 14.648910 |
| Atheist (do not believe in God) | 29.51456 | 6.213592 | 30.2912621 | 9.320388 | 15.145631 | 9.514563 |
| Buddhist | 57.66423 | 3.649635 | 4.6228710 | 14.841849 | 9.975669 | 9.245742 |
| Christian (VOL) | 56.67808 | 7.191781 | 3.9383562 | 11.301370 | 10.445206 | 10.445206 |
| Don’t know/Refused (VOL) | 40.40000 | 19.200000 | 11.6000000 | 7.200000 | 13.600000 | 8.000000 |
| Hindu | 46.69261 | 4.669261 | 8.1712062 | 7.392996 | 10.505837 | 22.568093 |
| Jehovah’s Witness (VOL) | 79.34272 | 2.816901 | 3.2863850 | 5.633803 | 2.816901 | 6.103286 |
| Jewish (Judaism) | 35.33724 | 6.011730 | 9.6774194 | 14.076246 | 21.114369 | 13.782991 |
| Mormon (Church of Jesus Christ of Latter-day Saints/LDS) | 74.01033 | 2.237522 | 0.5163511 | 11.187608 | 4.475043 | 7.573150 |
| Muslim (Islam) | 65.51724 | 3.448276 | 3.4482759 | 12.931035 | 7.758621 | 6.896552 |
| Nothing in particular | 37.25384 | 4.343135 | 13.2452118 | 12.274076 | 20.852441 | 12.031292 |
| Orthodox (Greek, Russian, or some other orthodox church) | 46.83196 | 3.581267 | 5.7851240 | 16.253443 | 12.121212 | 15.426997 |
| Protestant | 61.29788 | 3.220182 | 2.8932600 | 13.262137 | 8.483627 | 10.842914 |
| Roman Catholic | 48.72623 | 3.442277 | 4.7719647 | 15.558593 | 12.016901 | 15.484031 |
| Unitarian (Universalist) (VOL) | 54.54545 | 1.948052 | 5.8441558 | 18.181818 | 11.038961 | 8.441558 |
Peace_Wonder <- survey_data_2007 %>%
group_by(q16) %>%
filter(n() > 100) %>% # Keep only religions with more than 100 respondents
ungroup() %>%
filter(!is.na(q16), !is.na(q43a)) %>% # Ensure q16 and q43b are not NA
group_by(q16, q43b) %>%
summarise(Count = n(), .groups = 'drop') %>% # Count occurrences and drop grouping
ungroup() %>%
group_by(q16) %>%
mutate(Total = sum(Count),
Percentage = (Count / Total) * 100) %>%
ungroup() %>%
arrange(q16, q43b)
Peace_Wonder_selected <- select(Peace_Wonder, q16, q43b, Percentage)
Peace_Wonder_wide <- pivot_wider(
Peace_Wonder_selected,
names_from = q43b, # This column's unique values will become the names of the new columns
values_from = Percentage, # The cell values will come from the 'Percentage' column
values_fill = list(Percentage = 0) # Fill missing combinations with 0%
)
colnames(Peace_Wonder_wide)[1] <- "Religion"
# Create the table with kable and add styling with kableExtra
table <- kable(Peace_Wonder_wide, "html") %>%
kable_styling("striped", full_width = T) %>%
add_header_above(c(" " = 1, "feel a deep sense of wonder about the universe" = 5, " " = 1)) %>%
row_spec(0, bold = T, color = "white", background = "#636363") %>%
scroll_box( height = "100%") %>%
column_spec(1, bold = T)
# If you want to see the table in RStudio's Viewer
table| Religion | At least once a week | Don’t know/Refused (VOL.) | Never | Once or twice a month | Seldom | Several times a year |
|---|---|---|---|---|---|---|
| Agnostic (not sure if there is a God) | 47.82082 | 0.4842615 | 6.537530 | 16.828087 | 15.254237 | 13.075060 |
| Atheist (do not believe in God) | 39.80583 | 2.7184466 | 15.728155 | 13.203883 | 16.310680 | 12.233010 |
| Buddhist | 61.55718 | 2.9197080 | 7.299270 | 11.678832 | 7.542579 | 9.002433 |
| Christian (VOL) | 41.09589 | 6.8493151 | 12.500000 | 12.157534 | 14.897260 | 12.500000 |
| Don’t know/Refused (VOL) | 44.00000 | 16.8000000 | 8.800000 | 9.200000 | 14.400000 | 6.800000 |
| Hindu | 37.35409 | 3.5019455 | 7.782101 | 12.062257 | 14.396887 | 24.902724 |
| Jehovah’s Witness (VOL) | 52.58216 | 5.6338028 | 16.901408 | 9.389671 | 7.042254 | 8.450704 |
| Jewish (Judaism) | 39.14956 | 3.9589443 | 11.583578 | 12.903226 | 15.249267 | 17.155425 |
| Mormon (Church of Jesus Christ of Latter-day Saints/LDS) | 43.71773 | 3.4423408 | 8.950086 | 16.006885 | 13.941480 | 13.941480 |
| Muslim (Islam) | 54.31034 | 5.1724138 | 6.896552 | 12.931035 | 13.793103 | 6.896552 |
| Nothing in particular | 39.06124 | 3.0213110 | 11.141084 | 12.651740 | 19.773402 | 14.351227 |
| Orthodox (Greek, Russian, or some other orthodox church) | 36.91460 | 3.8567493 | 11.019284 | 13.223140 | 15.151515 | 19.834711 |
| Protestant | 41.02327 | 4.5769084 | 10.292595 | 14.139378 | 16.460524 | 13.507328 |
| Roman Catholic | 34.91985 | 3.8275134 | 10.960606 | 13.992792 | 19.572512 | 16.726730 |
| Unitarian (Universalist) (VOL) | 66.88312 | 1.9480519 | 2.597403 | 12.337662 | 7.792208 | 8.441558 |
While Mormons and protestant diverge from the general public on various religious beliefs and practices, they align closely with the broader population on this particular question. Approximately 41% of protestant, 43% of Mormons report feeling a deep sense of wonder about the universe on a weekly basis. This places them in close proximity to Jews (40%) and the unaffiliated (39%).
Interestingly, within the unaffiliated category, agnostics stand out as the subgroup most likely to frequently experience a sense of wonder, with 48% reporting weekly occurrences. This contrasts with the figures for atheists (37%), the religious unaffiliated (40%).
Quesion: My religion is the one true faith leading to eternal life, OR Many religions can lead to eternal life.
Faith_flexibility <- survey_data_2007 %>%
group_by(q16) %>%
filter(n() > 100) %>% # Keep only religions with more than 100 respondents
ungroup() %>%
filter(!is.na(q16), !is.na(q40a)) %>% # Ensure q16 and q43b are not NA
group_by(q16, q40a) %>%
summarise(Count = n(), .groups = 'drop') %>% # Count occurrences and drop grouping
ungroup() %>%
group_by(q16) %>%
mutate(Total = sum(Count),
Percentage = (Count / Total) * 100) %>%
ungroup() %>%
arrange(q16, q40a)
Faith_flexibility_selected <- select(Faith_flexibility, q16, q40a, Percentage)
Faith_flexibility_wide <- pivot_wider(
Faith_flexibility_selected,
names_from = q40a, # This column's unique values will become the names of the new columns
values_from = Percentage, # The cell values will come from the 'Percentage' column
values_fill = list(Percentage = 0) # Fill missing combinations with 0%
)
colnames(Faith_flexibility_wide)[1] <- "Religion"
# Create the table with kable and add styling with kableExtra
table <- kable(Faith_flexibility_wide, "html") %>%
kable_styling("striped", full_width = T) %>%
add_header_above(c(" " = 1, "is There More Than One Path to Salvation" = 3, " " = 1)) %>%
row_spec(0, bold = T, color = "white", background = "#636363") %>%
scroll_box( height = "100%") %>%
column_spec(1, bold = T)
# If you want to see the table in RStudio's Viewer
table| Religion | Don’t know/refused (VOL) | Many religions can lead to eternal life - Second statement | My religion is the one, true faith leading to eternal life - | Neither/Both equally (VOL) |
|---|---|---|---|---|
| Buddhist | 3.892944 | 85.88808 | 3.8929440 | 6.3260341 |
| Christian (VOL) | 8.047945 | 66.26712 | 23.4589041 | 2.2260274 |
| Hindu | 4.669261 | 89.49416 | 4.2801556 | 1.5564202 |
| Jehovah’s Witness (VOL) | 2.816901 | 14.55399 | 82.1596244 | 0.4694836 |
| Jewish (Judaism) | 6.158358 | 82.40469 | 3.5190616 | 7.9178886 |
| Mormon (Church of Jesus Christ of Latter-day Saints/LDS) | 1.549053 | 39.07057 | 56.6265060 | 2.7538726 |
| Muslim (Islam) | 10.344828 | 56.89655 | 29.3103448 | 3.4482759 |
| Orthodox (Greek, Russian, or some other orthodox church) | 4.958678 | 71.62534 | 20.1101928 | 3.3057851 |
| Protestant | 4.021141 | 67.88536 | 25.6906228 | 2.4028769 |
| Roman Catholic | 2.796073 | 81.91873 | 13.4211507 | 1.8640487 |
| Unitarian (Universalist) (VOL) | 3.246753 | 81.81818 | 0.6493506 | 14.2857143 |
# Assuming Combined_Heaven_Hell_wide has two columns: Religion, and Percentage with values for Heaven and Hell
# Inverting sign for "Hell" percentages
# Sample data frame
religions <- Faith_flexibility_wide$Religion
many_religions <- Faith_flexibility_wide$`Many religions can lead to eternal life - Second statement`
one_true_faith <- Faith_flexibility_wide$`My religion is the one, true faith leading to eternal life -`
df <- data.frame(
Religion = factor(religions, levels = religions),
`who_say_many_religions_can_lead_to_eternal_life` = many_religions,
`who_say_my_religion_is_the_one_true_faith_leading_to_eternal_life` = -one_true_faith
)
# Sort the religions based on 'Many religions can lead to eternal life'
df_sorted <- df %>%
arrange(desc(`who_say_many_religions_can_lead_to_eternal_life`))
# Update the factor levels of Religion to the new order
df_sorted$Religion <- factor(df_sorted$Religion, levels = df_sorted$Religion)
long_df <- pivot_longer(
df_sorted,
cols = c(`who_say_many_religions_can_lead_to_eternal_life`, `who_say_my_religion_is_the_one_true_faith_leading_to_eternal_life`),
names_to = "Belief",
values_to = "Percentage"
)
long_df <- long_df[order(long_df$Percentage, decreasing = TRUE),]
# Create the plot
p <- ggplot(long_df, aes(x = Religion, y = Percentage, fill = Belief)) +
geom_bar(stat = "identity", position = "identity") +
coord_flip() +
scale_fill_manual(values = c("#FFA07A", "blue")) +
labs(title = "Religious Exclusivity",
x = "",
y = "Percentage")+
theme_minimal() +
theme(legend.position = "right",
axis.ticks.y = element_blank(),
panel.grid = element_blank())
# Make it interactive
interactive_plot <- ggplotly(p , width = 1200 , height = 500)
# Show the interactive plot in your default browser
interactive_plot
The majority of Americans with a religious affiliation believe that many religions can lead to eternal life, with seven-in-ten holding this view. This perspective is widespread across various religious traditions, including more than eight-in-ten Jews, Buddhists, Hindus, and Protestant, as well as nearly eight-in-ten Catholics. However 56% of Muslims, share this belief. Notably, among Mormons and Jehovah’s Witnesses, a majority assert that their religion is the sole path to eternal life.
Quesion: There is only ONE true way to interpret the teachings of my religion, OR There is MORE than one true way to interpret the teachings of my religion.
More than two-thirds of Americans with a religious affiliation (68%) believe in the possibility of multiple interpretations of their faith’s teachings. A majority of members of evangelical churches (64%) share this view, along with upwards of six-in-ten individuals from most other religious traditions. Notably, a significant proportion of Jews (89%) and Buddhists (90%) express the belief in multiple valid interpretations of their religion’s teachings. However, Mormons and Jehovah’s Witnesses differ on this point, with majorities from both groups (54% among Mormons, 77% among Jehovah’s Witnesses) asserting that there is only one true interpretation of their religion’s teachings.
Faith_flexibility <- survey_data_2007 %>%
group_by(q16) %>%
filter(n() > 100) %>% # Keep only religions with more than 100 respondents
ungroup() %>%
filter(!is.na(q16), !is.na(q40b)) %>% # Ensure q16 and q40b are not NA
group_by(q16, q40b) %>%
summarise(Count = n(), .groups = 'drop') %>% # Count occurrences and drop grouping
ungroup() %>%
group_by(q16) %>%
mutate(Total = sum(Count),
Percentage = (Count / Total) * 100) %>%
ungroup() %>%
arrange(q16, q40b)
Faith_flexibility_selected <- select(Faith_flexibility, q16, q40b, Percentage)
Faith_flexibility_wide <- pivot_wider(
Faith_flexibility_selected,
names_from = q40b, # This column's unique values will become the names of the new columns
values_from = Percentage, # The cell values will come from the 'Percentage' column
values_fill = list(Percentage = 0) # Fill missing combinations with 0%
)
colnames(Faith_flexibility_wide)[1] <- "Religion"
# Create the table with kable and add styling with kableExtra
table <- kable(Faith_flexibility_wide, "html") %>%
kable_styling("striped", full_width = T) %>%
add_header_above(c(" " = 1, "Strictness of Interpretation" = 3, " " = 1)) %>%
row_spec(0, bold = T, color = "white", background = "#636363") %>%
scroll_box( height = "100%") %>%
column_spec(1, bold = T)
# If you want to see the table in RStudio's Viewer
table| Religion | Don’t know/refused (VOL) | Neither/Both equally (VOL) | There is MORE than one true way to interpret the teachings o | There is only ONE true way to interpret the teachings of my |
|---|---|---|---|---|
| Buddhist | 3.406326 | 0.4866180 | 90.99757 | 5.109489 |
| Christian (VOL) | 7.363014 | 2.7397260 | 64.72603 | 25.171233 |
| Hindu | 3.891051 | 1.1673152 | 84.82490 | 10.116732 |
| Jehovah’s Witness (VOL) | 4.225352 | 1.4084507 | 14.55399 | 79.812207 |
| Jewish (Judaism) | 3.519062 | 0.7331378 | 90.90909 | 4.838710 |
| Mormon (Church of Jesus Christ of Latter-day Saints/LDS) | 2.409639 | 1.5490534 | 39.75904 | 56.282272 |
| Muslim (Islam) | 6.896552 | 1.7241379 | 62.93103 | 28.448276 |
| Orthodox (Greek, Russian, or some other orthodox church) | 4.407713 | 1.1019284 | 67.49311 | 26.997245 |
| Protestant | 3.863129 | 1.1115349 | 64.05492 | 30.970414 |
| Roman Catholic | 3.380142 | 0.7704735 | 77.27103 | 18.578352 |
| Unitarian (Universalist) (VOL) | 1.298701 | 2.5974026 | 92.85714 | 3.246753 |
religions <- Faith_flexibility_wide$Religion
many_religions <- Faith_flexibility_wide$`There is MORE than one true way to interpret the teachings o`
one_true_faith <- Faith_flexibility_wide$`There is only ONE true way to interpret the teachings of my`
df <- data.frame(
Religion = factor(religions, levels = religions),
`There_is_MORE_than_one_true_way_to_interpret_the_teachings` = many_religions,
`There_is_only_one_true_way_to_interpret_the_teachings` = -one_true_faith
)
# Sort the religions based on 'Many religions can lead to eternal life'
df_sorted <- df %>%
arrange(desc(`There_is_MORE_than_one_true_way_to_interpret_the_teachings`))
# Update the factor levels of Religion to the new order
df_sorted$Religion <- factor(df_sorted$Religion, levels = df_sorted$Religion)
long_df <- pivot_longer(
df_sorted,
cols = c(`There_is_MORE_than_one_true_way_to_interpret_the_teachings`, `There_is_only_one_true_way_to_interpret_the_teachings`),
names_to = "Belief",
values_to = "Percentage"
)
long_df <- long_df[order(long_df$Percentage, decreasing = TRUE),]
# Create the plot
p <- ggplot(long_df, aes(x = Religion, y = Percentage, fill = Belief)) +
geom_bar(stat = "identity", position = "identity") +
coord_flip() +
scale_fill_manual(values = c("#FFA07A", "blue")) +
labs(title = "Religious Interpretablility",
x = "",
y = "Percentage")+
theme_minimal() +
theme(legend.position = "right",
axis.ticks.y = element_blank(),
panel.grid = element_blank())
# Make it interactive
interactive_plot <- ggplotly(p , width = 1200 , height = 500)
# Show the interactive plot in your default browser
interactive_plotQuesion: There are clear and absolute standards for what is right and wrong.
Right_Wrong <- survey_data_2007 %>%
group_by(q16) %>%
filter(n() > 100) %>% # Keep only religions with more than 100 respondents
ungroup() %>%
filter(!is.na(q16), !is.na(q10b)) %>% # Ensure q16 and q10b are not NA
group_by(q16, q10b) %>%
summarise(Count = n(), .groups = 'drop') %>% # Count occurrences and drop grouping
ungroup() %>%
group_by(q16) %>%
mutate(Total = sum(Count),
Percentage = (Count / Total) * 100) %>%
ungroup() %>%
arrange(q16, q10b)
Right_Wrong_selected <- select(Right_Wrong, q16, q10b, Percentage)
Right_Wrong_wide <- pivot_wider(
Right_Wrong_selected,
names_from = q10b, # This column's unique values will become the names of the new columns
values_from = Percentage, # The cell values will come from the 'Percentage' column
values_fill = list(Percentage = 0) # Fill missing combinations with 0%
)
colnames(Right_Wrong_wide)[1] <- "Religion"
# Create the table with kable and add styling with kableExtra
table <- kable(Right_Wrong_wide, "html") %>%
kable_styling("striped", full_width = T) %>%
add_header_above(c(" " = 1, "Absolute Standards of Right and Wrong" = 4, " " = 1)) %>%
row_spec(0, bold = T, color = "white", background = "#636363") %>%
scroll_box( height = "100%") %>%
column_spec(1, bold = T)
# If you want to see the table in RStudio's Viewer
table| Religion | Completely agree | Completely disagree | Don’t know/Refused (VOL.) | Mostly agree | Mostly disagree |
|---|---|---|---|---|---|
| Agnostic (not sure if there is a God) | 17.79661 | 12.469734 | 2.058111 | 40.43584 | 27.239709 |
| Atheist (do not believe in God) | 19.02913 | 14.563107 | 2.330097 | 38.05825 | 26.019417 |
| Buddhist | 13.38200 | 20.924574 | 3.163017 | 35.27981 | 27.250608 |
| Christian (VOL) | 38.69863 | 7.020548 | 3.938356 | 37.15753 | 13.184931 |
| Don’t know/Refused (VOL) | 26.80000 | 13.600000 | 8.800000 | 29.60000 | 21.200000 |
| Hindu | 20.62257 | 9.338521 | 6.225681 | 43.19066 | 20.622568 |
| Jehovah’s Witness (VOL) | 58.21596 | 4.225352 | 2.816901 | 26.76056 | 7.981221 |
| Jewish (Judaism) | 18.03519 | 9.824047 | 2.492669 | 44.28152 | 25.366569 |
| Mormon (Church of Jesus Christ of Latter-day Saints/LDS) | 45.78313 | 3.098107 | 1.549053 | 41.65232 | 7.917384 |
| Muslim (Islam) | 33.62069 | 7.758621 | 5.172414 | 36.20690 | 17.241379 |
| Nothing in particular | 29.24197 | 9.873213 | 2.346911 | 38.89938 | 19.638522 |
| Orthodox (Greek, Russian, or some other orthodox church) | 31.95592 | 7.988981 | 4.683196 | 40.22039 | 15.151515 |
| Protestant | 42.73961 | 4.811203 | 2.157685 | 38.13545 | 12.156051 |
| Roman Catholic | 36.47322 | 5.778551 | 2.423263 | 42.15235 | 13.172611 |
| Unitarian (Universalist) (VOL) | 11.03896 | 14.285714 | 4.545454 | 37.01299 | 33.116883 |
While most Americans believe in absolute standards of right and wrong, there are some differences among groups. For example, Buddhists, atheists, and agnostics are somewhat less likely to believe in absolute standards compared to other religious groups or the religiously unaffiliated as a whole. This suggests that while there’s a general trend toward believing in universal moral principles, individual beliefs can vary based on religious background or lack thereof.
The analysis of religious beliefs and practices across a diverse array of faiths and those without religious affiliation reveals significant insights into how religion—or the absence of it—shapes individuals’ worldviews, ethical standards, and daily practices.
Religious Affiliations: For those with religious affiliations, religion typically serves as a foundational element in their lives, deeply influencing their morals, behaviors, and outlooks. These individuals often view their religious tenets as not just beliefs but as integral truths that guide their understanding of the world, their behavior, and their expectations of the afterlife. They tend to participate more actively in community and religious rituals, which reinforces their faith and fosters a sense of belonging and identity. The belief in divine beings, miracles, and an active spiritual realm is prevalent, reflecting a worldview where the divine intimately interacts with the world.
Non-religious Individuals (Atheists, Agnostics, Unaffiliated): In contrast, those without religious affiliations often embrace a worldview grounded in secularism or humanism. This group tends to place less importance on structured beliefs and shows a higher propensity for skepticism towards supernatural claims and absolute truths. However, this does not imply a lack of ethical or moral consideration; many non-religious individuals still exhibit strong moral convictions and a sense of wonder about the universe, which they might attribute to philosophical or humanistic insights rather than spiritual or religious beliefs. Importantly, their engagement with spiritual practices, while less frequent, often occurs in a context that values cultural heritage or personal exploration over religious duty.
Shared Human Experience: Despite these differences, both groups share fundamental human experiences and emotions, such as the quest for meaning, the experience of awe, and the need for ethical guidelines. Both religious and non-religious individuals seek peace, purpose, and explanations for the complex world around them, albeit through different lenses.
Conclusion: This analysis suggests that while religious beliefs significantly shape one’s worldview and daily practices, underlying human experiences such as ethical dilemmas, spiritual peace, and existential wonder are universal. These findings indicate that the essence of human experience crosses the boundaries of religious and secular divides, pointing to a shared search for understanding and meaning that transcends specific belief systems. Thus, the dialogue between individuals of varying religious and non-religious backgrounds is not only possible but essential for a comprehensive understanding of the human condition.
In this section, we will focus on analyzing the change in religious affiliations between 2007 and 2014. By examining how the proportions of each religious group shifted over time, we aim to uncover trends and patterns in religious identification within the surveyed population. This analysis will provide insights into the evolving religious landscape and shed light on the dynamics driving changes in religious adherence during the specified period.
<br
# Assuming 'qe1' is the column for religion
religion_counts_2014 <- survey_data_2014 %>%
count(qe1) %>%
filter(n > 100)
# Rename the columns for clarity
colnames(religion_counts_2014) <- c("Religion", "Respondents")
# Calculate the total number of respondents
total_respondents <- sum(religion_counts_2014$Respondents)
# Calculate percentages
religion_counts_2014 <- religion_counts_2014 %>%
mutate(Percentage = (Respondents / total_respondents) * 100)
# Rename the columns for clarity
colnames(religion_counts_2007) <- c("Religion", "Respondents_2007","Percentage_2007")
colnames(religion_counts_2014) <- c("Religion", "Respondents_2014","Percentage_2014")
# Assuming religion_counts_2007 and religion_counts_2014 are your data frames
# First, ensure that the 'Religion' column is treated as a character for accurate comparisons
religion_counts_2007$Religion <- as.character(religion_counts_2007$Religion)
religion_counts_2014$Religion <- as.character(religion_counts_2014$Religion)
# Identify religions present in both 2007 and 2014
common_religions <- intersect(religion_counts_2007$Religion, religion_counts_2014$Religion)
# Filter both data frames to include only common religions
religion_counts_2007 <- religion_counts_2007 %>%
filter(Religion %in% common_religions)
religion_counts_2014 <- religion_counts_2014 %>%
filter(Religion %in% common_religions)
# Merge the data frames
religion_changes <- merge(religion_counts_2007, religion_counts_2014, by = "Religion")
# Calculate changes
religion_changes <- religion_changes %>%
mutate(Count_Change = Respondents_2014 - Respondents_2007,
Percentage_Change = Percentage_2014 - Percentage_2007)p <- ggplot(religion_changes, aes(x = reorder(Religion, -Percentage_Change), y = Percentage_Change, fill = Religion)) +
geom_col() +
coord_flip() +
labs(title = "Change in Religious Affiliation from 2007 to 2014",
x = "Religion",
y = "Change in Count") +
theme_minimal() +
theme(legend.position = "none")
# Make it interactive
interactive_plot <- ggplotly(p , width = 1200 , height = 500)
# Show the interactive plot in your default browser
interactive_plotThese changes suggest a dynamic landscape of religious affiliation over the examined period, with shifts towards non-affiliation or alternative religious beliefs alongside declines in traditional denominations like Protestantism and Catholicism.
This section provides a comparative analysis of the importance of religion in individuals’ lives across various religious groups between the years 2007 and 2014. Through a side-by-side visualization, the shift in attitudes towards religion is depicted, showcasing the percentage of respondents within each religious category who rated religion as “Not at all important,” “Not too important,” “Somewhat important,” and “Very important.” The chart illuminates trends suggesting a declining emphasis on religion over time, with some groups demonstrating a more pronounced shift towards secularism, while others maintain a steadfast commitment to religious values. This examination offers valuable insights into the evolving landscape of religious beliefs and practices in contemporary society.
religion_importance_2014 <- survey_data_2014 %>%
group_by(qe1) %>%
filter(n() > 100) %>% # Keep only religions with more than 100 respondents
ungroup() %>%
filter(!is.na(qe1), !is.na(qf2)) %>% # Ensure qe1 and qf2 are not NA
group_by(qe1, qf2) %>%
summarise(Count = n(), .groups = 'drop') %>% # Count occurrences and drop grouping
ungroup() %>%
group_by(qe1) %>%
mutate(Total = sum(Count),
Percentage = (Count / Total) * 100) %>%
ungroup() %>%
arrange(qe1, qf2)
religion_importance_2014_selected <- select(religion_importance_2014, qe1, qf2, Percentage)
religion_importance_2014_wide <- pivot_wider(
religion_importance_2014_selected,
names_from = qf2, # This column's unique values will become the names of the new columns
values_from = Percentage, # The cell values will come from the 'Percentage' column
values_fill = list(Percentage = 0) # Fill missing combinations with 0%
)
colnames(religion_importance_2014_wide)[1] <- "Religion"
# Create the table with kable and add styling with kableExtra
table <- kable(religion_importance_2014_wide, "html", align = c('l', rep('c', 10))) %>%
kable_styling("striped", full_width = F) %>%
add_header_above(c(" " = 1, "How important is religion in your life (2014) " = 4, " " = 1)) %>%
row_spec(0, bold = T, color = "white", background = "#636363") %>%
column_spec(1, bold = T)
# If you want to see the table in RStudio's Viewer
table| Religion | (VOL) Don’t Know/Refused | Not at all important | Not too important | Somewhat important | Very important |
|---|---|---|---|---|---|
| Agnostic (not sure if there is a God) | 0.8819539 | 52.1031208 | 31.0719132 | 12.483039 | 3.459973 |
| Atheist (do not believe in God) | 0.4553734 | 82.6047359 | 10.2003643 | 4.735883 | 2.003643 |
| Buddhist | 2.2727273 | 12.1212121 | 18.1818182 | 34.090909 | 33.333333 |
| Christian (VOL) | 1.8666667 | 4.0000000 | 7.8666667 | 25.066667 | 61.200000 |
| Don’t Know/Refused (VOL) | 16.8831169 | 25.3246753 | 13.6363636 | 20.129870 | 24.025974 |
| Hindu | 1.5075377 | 6.0301508 | 15.5778894 | 48.743719 | 28.140704 |
| Jehovah’s Witness (VOL) | 0.8196721 | 0.8196721 | 0.8196721 | 6.147541 | 91.393443 |
| Jewish (Judaism) | 0.5903188 | 9.9173554 | 19.5985832 | 36.953955 | 32.939788 |
| Mormon (Church of Jesus Christ of Latter-day Saints/LDS) | 0.0000000 | 0.9036145 | 2.4096386 | 12.500000 | 84.186747 |
| Muslim (Islam) | 1.2658228 | 2.5316456 | 9.2827004 | 21.940928 | 64.978903 |
| Nothing in particular | 1.1637239 | 31.2399679 | 27.1669342 | 25.321027 | 15.108347 |
| Orthodox (Greek, Russian, or some other orthodox church) | 0.5376344 | 3.2258065 | 11.8279570 | 33.870968 | 50.537634 |
| Protestant | 0.5870471 | 1.2435299 | 4.6521904 | 21.537685 | 71.979548 |
| Roman Catholic | 0.3891051 | 2.2234575 | 7.9071707 | 30.864369 | 58.615898 |
| Spiritual but not religious (‘believe in God, but…’) (VOL) | 1.5625000 | 32.0312500 | 16.4062500 | 28.906250 | 21.093750 |
| Unitarian (Universalist) (VOL) | 1.8181818 | 9.6969697 | 24.2424242 | 36.363636 | 27.878788 |
# Assuming the data frames are named religion_importance_2007 and religion_importance_2014
# Filter both data frames to include only common religions
religion_counts_2007 <- religion_counts_2007 %>%
filter(Religion %in% common_religions)
religion_counts_2014 <- religion_counts_2014 %>%
filter(Religion %in% common_religions)
# Convert data from wide to long format for easier plotting
religion_importance_2007_long <- pivot_longer(religion_importance_wide, cols = -Religion, names_to = "Importance", values_to = "Percentage_2007")
religion_importance_2014_long <- pivot_longer(religion_importance_2014_wide, cols = -Religion, names_to = "Importance", values_to = "Percentage_2014")
# Filter both data frames to include only common religions
religion_importance_2007_long <- religion_importance_2007_long %>%
filter(Religion %in% common_religions)
religion_importance_2014_long <- religion_importance_2014_long %>%
filter(Religion %in% common_religions)# Merge the two datasets
religion_importance_combined <- full_join(religion_importance_2007_long, religion_importance_2014_long, by = c("Religion", "Importance"))
# Check and clean any NA values that might result from the join if there are religions not present in both datasets
religion_importance_combined <- drop_na(religion_importance_combined)
# Changes in religion importance
religion_importance_combined <- religion_importance_combined %>%
mutate(Percentage_change = Percentage_2014 - Percentage_2007)
# Heatmap for both years
p <- ggplot(religion_importance_combined, aes(x = Religion, y = Importance, fill = Percentage_change)) +
geom_tile() + # Create the tiles for the heatmap
scale_fill_gradient(low = "white", high = "steelblue") + # Gradient from white (low) to steel blue (high)
theme_minimal() +
theme(axis.text.x = element_text(angle = 45, hjust = 1), axis.text.y = element_text(size = 12), title = element_text(size = 20)) +
labs(title = "Changes in responses on the Importance of Religion by Religious Group",
x = "Religion",
y = "Importance",
fill = "Percentage")
# Make it interactive
interactive_plot <- ggplotly(p , width = 1200 , height = 750)
# Show the interactive plot in your default browser
interactive_plotExplanation: This visualization illustrates the evolving perception of the importance of religion in the lives of various religious groups between 2007 and 2014. The chart depicts the percentage of respondents within each religious group who reported different levels of importance
Key observations from the visualization might include: 1. Overall, there appears to be a trend towards decreased importance of religion across most religious groups from 2007 to 2014. 2. Some groups, such as atheists and agnostics, show a notable increase in the percentage of respondents who view religion as “Not at all important,” suggesting a shift towards secularism. 3. Conversely, certain groups like Jehovah’s Witnesses and Mormons seem to maintain a consistently high percentage of respondents who perceive religion as “Very important” throughout both years. 4. The chart also highlights variations in the importance of religion among different religious communities, reflecting the diversity of attitudes and beliefs within and across religious traditions.
This section presents a comparative examination of attitudes towards abortion across different religious groups between the years 2007 and 2014. The data illustrate respondents’ opinions on whether abortion should be illegal or legal in varying circumstances, including “Illegal in all cases,” “Illegal in most cases,” “Legal in all cases,” and “Legal in most cases.” By juxtaposing the percentages of respondents within each religious category, the chart highlights evolving perspectives on abortion rights over time.
Abortion_2014 <- survey_data_2014 %>%
group_by(qe1) %>%
filter(n() > 100) %>% # Keep only religions with more than 100 respondents
ungroup() %>%
filter(!is.na(qe1), !is.na(qb21)) %>% # Ensure qe1 and qb21 are not NA
group_by(qe1, qb21) %>%
summarise(Count = n(), .groups = 'drop') %>% # Count occurrences and drop grouping
ungroup() %>%
group_by(qe1) %>%
mutate(Total = sum(Count),
Percentage = (Count / Total) * 100) %>%
ungroup() %>%
arrange(qe1, qb21)
Abortion_2014_selected <- select(Abortion_2014, qe1, qb21, Percentage)
Abortion_2014_wide <- pivot_wider(
Abortion_2014_selected,
names_from = qb21, # This column's unique values will become the names of the new columns
values_from = Percentage, # The cell values will come from the 'Percentage' column
values_fill = list(Percentage = 0) # Fill missing combinations with 0%
)
colnames(Abortion_2014_wide)[1] <- "Religion"
# Create the table with kable and add styling with kableExtra
table <- kable(Abortion_2014_wide, "html", align = c('l', rep('c', 10))) %>%
kable_styling("striped", full_width = F) %>%
add_header_above(c(" " = 1, "Abortion Should Be… " = 4, " " = 1)) %>%
row_spec(0, bold = T, color = "white", background = "#636363") %>%
column_spec(1, bold = T)
# If you want to see the table in RStudio's Viewer
table| Religion | (VOL) Don’t know/Refused | Illegal in all cases | Illegal in most cases | Legal in all cases | Legal in most cases |
|---|---|---|---|---|---|
| Agnostic (not sure if there is a God) | 2.103121 | 1.7639077 | 8.073270 | 38.941655 | 49.11805 |
| Atheist (do not believe in God) | 2.185792 | 2.5500911 | 5.828780 | 51.639344 | 37.79599 |
| Buddhist | 1.136364 | 2.6515152 | 9.848485 | 40.530303 | 45.83333 |
| Christian (VOL) | 9.333333 | 17.2000000 | 23.200000 | 17.866667 | 32.40000 |
| Don’t Know/Refused (VOL) | 15.584416 | 5.1948052 | 11.038961 | 38.961039 | 29.22078 |
| Hindu | 4.522613 | 10.5527638 | 13.065327 | 26.130653 | 45.72864 |
| Jehovah’s Witness (VOL) | 6.557377 | 53.6885246 | 21.721311 | 4.508197 | 13.52459 |
| Jewish (Judaism) | 2.007084 | 2.5974026 | 8.736718 | 42.739079 | 43.91972 |
| Mormon (Church of Jesus Christ of Latter-day Saints/LDS) | 2.861446 | 9.3373494 | 62.048193 | 6.024096 | 19.72892 |
| Muslim (Islam) | 7.594937 | 12.2362869 | 24.894515 | 14.345992 | 40.92827 |
| Nothing in particular | 4.514446 | 7.8852327 | 16.512841 | 31.741573 | 39.34591 |
| Orthodox (Greek, Russian, or some other orthodox church) | 3.763441 | 8.0645161 | 33.333333 | 20.430107 | 34.40860 |
| Protestant | 4.336574 | 16.9296806 | 33.385936 | 13.704078 | 31.64373 |
| Roman Catholic | 4.877710 | 17.7181768 | 29.335742 | 16.133963 | 31.93441 |
| Spiritual but not religious (‘believe in God, but…’) (VOL) | 10.156250 | 3.9062500 | 17.187500 | 30.468750 | 38.28125 |
| Unitarian (Universalist) (VOL) | 3.030303 | 0.6060606 | 5.454546 | 46.060606 | 44.84848 |
# Convert data from wide to long format for easier plotting
Abortion_2007_long <- pivot_longer(Abortion_wide, cols = -Religion, names_to = "Importance", values_to = "Percentage_2007")
Abortion_2014_long <- pivot_longer(Abortion_2014_wide, cols = -Religion, names_to = "Importance", values_to = "Percentage_2014")
# Filter both data frames to include only common religions
Abortion_2007_long <- Abortion_2007_long %>%
filter(Religion %in% common_religions)
Abortion_2014_long <- Abortion_2014_long %>%
filter(Religion %in% common_religions)
# Merge the two datasets
Abortion_combined <- full_join(Abortion_2007_long, Abortion_2014_long, by = c("Religion","Importance"))
# Check and clean any NA values that might result from the join if there are religions not present in both datasets
Abortion_combined <- drop_na(Abortion_combined)
# Changes in religion importance
Abortion_combined <- Abortion_combined %>%
mutate(Percentage_change = Percentage_2014 - Percentage_2007)
# Heatmap for both years
p <- ggplot(Abortion_combined, aes(x = Religion, y = Importance, fill = Percentage_change)) +
geom_tile() + # Create the tiles for the heatmap
scale_fill_gradient(low = "white", high = "steelblue") + # Gradient from white (low) to steel blue (high)
theme_minimal() +
theme(axis.text.x = element_text(angle = 45, hjust = 1), title = element_text(size = 15)) +
labs(title = "Changes in responses on the Abortion by Religious Group",
x = "Religion",
y = "",
fill = "Percentage")
# Make it interactive
interactive_plot <- ggplotly(p , width = 1200 , height = 750)
# Show the interactive plot in your default browser
interactive_plotConsistency in Views: Some religious groups, such as Mormons (LDS) and Jews, maintained relatively consistent stances on abortion between 2007 and 2014. These groups showed minimal changes in their percentages across the categories of “Illegal in all cases,” “Illegal in most cases,” “Legal in all cases,” and “Legal in most cases.” This consistency suggests a stable adherence to their respective religious teachings or moral convictions regarding abortion over the years.
Decrease in Opposition: In several religious categories, there was a decrease in the percentage of respondents favoring strict restrictions on abortion. For example, among Protestants and Roman Catholics, there was a decline in the proportion of respondents advocating for abortion to be illegal in all or most cases. This shift may indicate a growing acceptance of more liberal abortion policies within these religious communities over time.
Increase in Support for Legalization: Conversely, some religious groups saw an increase in the percentage of respondents supporting legalized abortion, particularly in certain circumstances. This trend was evident among Atheists, Buddhists, and Muslims, where a higher proportion of respondents expressed support for abortion being legal in all or most cases in 2014 compared to 2007. This suggests a potential loosening of traditional views on abortion within these religious communities.
Varied Responses: While some religious groups exhibited clear shifts towards either more restrictive or more permissive attitudes on abortion, others showed mixed or inconsistent changes. For instance, Jehovah’s Witnesses and Orthodox Christians displayed fluctuating percentages across different categories, indicating a divergence of opinions within these religious communities over the years.
This analysis examines the evolving perceptions of homosexuality within different religious communities over the span of seven years, from 2007 to 2014. By comparing data from these two time points, we gain insights into the shifting attitudes towards LGBTQ+ rights and acceptance within various religious groups. The findings highlight trends such as decreasing disapproval, increasing acceptance, and the variability of attitudes across different religious affiliations.
Homosexuality_2014 <- survey_data_2014 %>%
group_by(qe1) %>%
filter(n() > 100) %>% # Keep only religions with more than 100 respondents
ungroup() %>%
filter(!is.na(qe1), !is.na(qb22)) %>% # Ensure qe1 and q2b2 are not NA
group_by(qe1, qb22) %>%
summarise(Count = n(), .groups = 'drop') %>% # Count occurrences and drop grouping
ungroup() %>%
group_by(qe1) %>%
mutate(Total = sum(Count),
Percentage = (Count / Total) * 100) %>%
ungroup() %>%
arrange(qe1, qb22)
Homosexuality_2014_selected <- select(Homosexuality_2014, qe1, qb22, Percentage)
Homosexuality_2014_wide <- pivot_wider(
Homosexuality_2014_selected,
names_from = qb22, # This column's unique values will become the names of the new columns
values_from = Percentage, # The cell values will come from the 'Percentage' column
values_fill = list(Percentage = 0) # Fill missing combinations with 0%
)
colnames(Homosexuality_2014_wide)[1] <- "Religion"
# Create the table with kable and add styling with kableExtra
table <- kable(Homosexuality_2014_wide, "html", align = c('l', rep('c', 10))) %>%
kable_styling("striped", full_width = F) %>%
add_header_above(c(" " = 1, "Allowing gays and lesbians to marry legally? " = 4, " " = 1)) %>%
row_spec(0, bold = T, color = "white", background = "#636363") %>%
column_spec(1, bold = T)
# If you want to see the table in RStudio's Viewer
table| Religion | (VOL) Don’t know/Refused | Favor | Oppose | Strongly favor | Strongly oppose |
|---|---|---|---|---|---|
| Agnostic (not sure if there is a God) | 3.188602 | 32.225237 | 4.545454 | 58.208955 | 1.831750 |
| Atheist (do not believe in God) | 2.367942 | 27.504554 | 2.914390 | 65.209472 | 2.003643 |
| Buddhist | 3.030303 | 39.772727 | 4.924242 | 47.727273 | 4.545454 |
| Christian (VOL) | 13.866667 | 25.466667 | 19.600000 | 20.933333 | 20.133333 |
| Don’t Know/Refused (VOL) | 16.883117 | 26.623377 | 12.987013 | 36.363636 | 7.142857 |
| Hindu | 11.055276 | 33.668342 | 14.572864 | 29.648241 | 11.055276 |
| Jehovah’s Witness (VOL) | 10.655738 | 7.377049 | 35.245902 | 5.327869 | 41.393443 |
| Jewish (Judaism) | 4.604486 | 32.231405 | 7.674144 | 49.114522 | 6.375443 |
| Mormon (Church of Jesus Christ of Latter-day Saints/LDS) | 6.174699 | 15.361446 | 36.295181 | 7.981928 | 34.186747 |
| Muslim (Islam) | 6.329114 | 25.738397 | 22.362869 | 18.565401 | 27.004219 |
| Nothing in particular | 7.423756 | 35.433387 | 11.898074 | 37.700642 | 7.544141 |
| Orthodox (Greek, Russian, or some other orthodox church) | 6.989247 | 29.569893 | 25.806452 | 26.881720 | 10.752688 |
| Protestant | 7.713673 | 23.930059 | 27.269284 | 14.467870 | 26.619114 |
| Roman Catholic | 8.949416 | 35.575320 | 22.206782 | 20.094497 | 13.173986 |
| Spiritual but not religious (‘believe in God, but…’) (VOL) | 12.500000 | 32.031250 | 6.250000 | 43.750000 | 5.468750 |
| Unitarian (Universalist) (VOL) | 2.424242 | 24.848485 | 2.424242 | 69.090909 | 1.212121 |
Consistency in Acceptance: In both 2007 and 2014, Agnostics, Atheists, and Buddhists consistently showed high levels of acceptance towards homosexuality. These groups maintained relatively stable percentages of respondents who believed that homosexuality is a way of life that should be accepted.
Decrease in Disapproval: Across various religious categories, there was a notable decrease in the percentage of respondents who believed that homosexuality should be discouraged. For example, among Mormons (LDS) and Muslims, there was a decline in the proportion of individuals advocating for discouraging homosexuality. This suggests a shift towards more accepting attitudes within these religious communities over time.
Increase in Acceptance: Conversely, some religious groups witnessed an increase in the percentage of respondents supporting the acceptance of homosexuality. Notably, Protestants and Orthodox Christians showed a rise in the proportion of individuals endorsing acceptance of homosexuality as a way of life. This indicates a potential evolution in attitudes towards LGBTQ+ rights within these religious communities over the surveyed period.
Religious Variability: The data also reveal a diverse range of attitudes towards homosexuality across different religious groups. While some communities, such as Unitarian Universalists, overwhelmingly support the acceptance of homosexuality, others, like Jehovah’s Witnesses, maintain more conservative views on the matter.
This comparative study examines the changing attitudes towards evolution across different religious affiliations between 2007 and 2014. The data reveals shifts in opinions regarding the origins of human life and the role of evolution, from the influence of a supreme being to natural processes such as natural selection.
Evolution_2014 <- survey_data_2014 %>%
group_by(qe1) %>%
filter(n() > 100) %>% # Keep only religions with more than 100 respondents
ungroup() %>%
filter(!is.na(qe1), !is.na(qb30b)) %>% # Ensure qe1 and q2b2 are not NA
group_by(qe1, qb30b) %>%
summarise(Count = n(), .groups = 'drop') %>% # Count occurrences and drop grouping
ungroup() %>%
group_by(qe1) %>%
mutate(Total = sum(Count),
Percentage = (Count / Total) * 100) %>%
ungroup() %>%
arrange(qe1, qb30b)
Evolution_2014_selected <- select(Evolution_2014, qe1, qb30b, Percentage)
Evolution_2014_wide <- pivot_wider(
Evolution_2014_selected,
names_from = qb30b, # This column's unique values will become the names of the new columns
values_from = Percentage, # The cell values will come from the 'Percentage' column
values_fill = list(Percentage = 0) # Fill missing combinations with 0%
)
colnames(Evolution_2014_wide)[1] <- "Religion"
# Create the table with kable and add styling with kableExtra
table <- kable(Evolution_2014_wide, "html", align = c('l', rep('c', 10))) %>%
kable_styling("striped", full_width = F) %>%
add_header_above(c(" " = 1, "Allowing gays and lesbians to marry legally? " = 2, " " = 1)) %>%
row_spec(0, bold = T, color = "white", background = "#636363") %>%
column_spec(1, bold = T)
# If you want to see the table in RStudio's Viewer
table| Religion | (VOL) Don’t know/Refused | A supreme being guided the evolution of living things for the purpose of creating humans and other life… | Humans and other living things have evolved due to natural processes such as natural selection, OR |
|---|---|---|---|
| Agnostic (not sure if there is a God) | 4.812456 | 6.440198 | 88.74735 |
| Atheist (do not believe in God) | 1.238095 | 1.904762 | 96.85714 |
| Buddhist | 5.603448 | 12.068965 | 82.32759 |
| Christian (VOL) | 12.235294 | 51.058824 | 36.70588 |
| Don’t Know/Refused (VOL) | 20.175439 | 17.543860 | 62.28070 |
| Hindu | 5.844156 | 17.532467 | 76.62338 |
| Jehovah’s Witness (VOL) | 0.000000 | 68.888889 | 31.11111 |
| Jewish (Judaism) | 7.412587 | 17.622378 | 74.96504 |
| Mormon (Church of Jesus Christ of Latter-day Saints/LDS) | 5.797101 | 69.565217 | 24.63768 |
| Muslim (Islam) | 6.716418 | 48.507463 | 44.77612 |
| Nothing in particular | 6.381897 | 21.179761 | 72.43834 |
| Orthodox (Greek, Russian, or some other orthodox church) | 6.034483 | 43.103448 | 50.86207 |
| Protestant | 7.142857 | 56.100661 | 36.75648 |
| Roman Catholic | 7.121058 | 48.809766 | 44.06918 |
| Spiritual but not religious (‘believe in God, but…’) (VOL) | 9.375000 | 44.791667 | 45.83333 |
| Unitarian (Universalist) (VOL) | 5.298013 | 9.271523 | 85.43046 |
Agnostic and Atheist Perspectives: Both agnostic and atheist respondents consistently leaned towards acceptance of evolution due to natural processes across both years. While there were slight fluctuations, the majority maintained their stance in favor of natural selection as the explanation for the origins of human life.
Buddhist, Hindu, and Unitarian Universalist Views: These groups also exhibited strong support for evolution driven by natural processes, with minimal changes observed between 2007 and 2014. Their beliefs remained largely consistent over the seven-year period.
Christian Denominations: Within Christian denominations, there was a notable divide. While some denominations, such as Unitarian Universalists, showed overwhelming support for evolution driven by natural processes, others, particularly Jehovah’s Witnesses and Mormons, maintained beliefs in a supreme being guiding evolution. Protestant and Roman Catholic groups demonstrated mixed views, with a significant portion supporting natural selection but also a sizable minority endorsing a divine-guided evolution.
Overall Trends: Across most religious groups, there was a slight increase in acceptance of evolution driven by natural processes from 2007 to 2014. This indicates a gradual shift towards secular interpretations of evolutionary theory within various religious communities, although some groups still maintain strong beliefs in divine involvement in the process.
This section examines the shifts in the frequency of experiencing spiritual peace and well-being among various religious groups between 2007 and 2014. The data reveal changes in the proportions of respondents within each group who reported experiencing spiritual peace and well-being at different frequencies, ranging from at least once a week to never.
Peace_Wonder_2014 <- survey_data_2014 %>%
group_by(qe1) %>%
filter(n() > 100) %>% # Keep only religions with more than 100 respondents
ungroup() %>%
filter(!is.na(qe1), !is.na(qi4a)) %>% # Ensure qe1 and q14a are not NA
group_by(qe1, qi4a) %>%
summarise(Count = n(), .groups = 'drop') %>% # Count occurrences and drop grouping
ungroup() %>%
group_by(qe1) %>%
mutate(Total = sum(Count),
Percentage = (Count / Total) * 100) %>%
ungroup() %>%
arrange(qe1, qi4a)
Peace_Wonder_2014_selected <- select(Peace_Wonder_2014, qe1, qi4a, Percentage)
Peace_Wonder_2014_wide <- pivot_wider(
Peace_Wonder_2014_selected,
names_from = qi4a, # This column's unique values will become the names of the new columns
values_from = Percentage, # The cell values will come from the 'Percentage' column
values_fill = list(Percentage = 0) # Fill missing combinations with 0%
)
colnames(Peace_Wonder_2014_wide)[1] <- "Religion"
# Create the table with kable and add styling with kableExtra
table <- kable(Peace_Wonder_2014_wide, "html") %>%
kable_styling("striped", full_width = T) %>%
add_header_above(c(" " = 1, "feel a deep sense of spiritual peace and well-being" = 5, " " = 1)) %>%
row_spec(0, bold = T, color = "white", background = "#636363") %>%
scroll_box( height = "100%") %>%
column_spec(1, bold = T)
# If you want to see the table in RStudio's Viewer
table| Religion | (VOL) Don’t Know/Refused | At least once a week | Never | Once or twice a month | Seldom | Several times a year |
|---|---|---|---|---|---|---|
| Agnostic (not sure if there is a God) | 1.4925373 | 37.51696 | 13.4328358 | 18.249661 | 16.824966 | 12.483039 |
| Atheist (do not believe in God) | 2.2768670 | 32.69581 | 28.8706740 | 14.480874 | 14.298725 | 7.377049 |
| Buddhist | 0.7575758 | 62.87879 | 2.2727273 | 16.287879 | 8.712121 | 9.090909 |
| Christian (VOL) | 2.5333333 | 62.00000 | 4.1333333 | 16.800000 | 7.333333 | 7.200000 |
| Don’t Know/Refused (VOL) | 13.6363636 | 46.75325 | 9.7402597 | 11.038961 | 10.389610 | 8.441558 |
| Hindu | 2.0100503 | 45.22613 | 2.0100503 | 16.582915 | 13.567839 | 20.603015 |
| Jehovah’s Witness (VOL) | 3.2786885 | 82.78689 | 1.2295082 | 4.918033 | 2.868853 | 4.918033 |
| Jewish (Judaism) | 1.7709563 | 37.78040 | 9.2089728 | 17.709563 | 18.536009 | 14.994097 |
| Mormon (Church of Jesus Christ of Latter-day Saints/LDS) | 1.0542169 | 82.07831 | 1.3554217 | 8.734940 | 2.560241 | 4.216868 |
| Muslim (Islam) | 3.7974684 | 64.13502 | 0.8438819 | 15.189873 | 5.485232 | 10.548523 |
| Nothing in particular | 2.1268058 | 42.85714 | 11.1757624 | 15.308989 | 17.475923 | 11.055377 |
| Orthodox (Greek, Russian, or some other orthodox church) | 1.0752688 | 55.37634 | 4.3010753 | 20.967742 | 8.602151 | 9.677419 |
| Protestant | 1.1551572 | 69.63136 | 1.8621386 | 13.142280 | 6.590077 | 7.618988 |
| Roman Catholic | 1.3618677 | 57.99055 | 3.1267371 | 16.286826 | 10.241801 | 10.992218 |
| Spiritual but not religious (‘believe in God, but…’) (VOL) | 0.7812500 | 75.00000 | 1.5625000 | 12.500000 | 5.468750 | 4.687500 |
| Unitarian (Universalist) (VOL) | 3.0303030 | 56.36364 | 3.0303030 | 13.939394 | 12.727273 | 10.909091 |
# Convert data from wide to long format for easier plotting
Peace_Wonder_2007_long <- pivot_longer(Peace_Wonder_wide, cols = -Religion, names_to = "Importance", values_to = "Percentage_2007")
Peace_Wonder_2014_long <- pivot_longer(Peace_Wonder_2014_wide, cols = -Religion, names_to = "Importance", values_to = "Percentage_2014")
# Filter both data frames to include only common religions
Peace_Wonder_2007_long <- Peace_Wonder_2007_long %>%
filter(Religion %in% common_religions)
Peace_Wonder_2014_long <- Peace_Wonder_2014_long %>%
filter(Religion %in% common_religions)
# Merge the two datasets
Peace_Wonder_combined <- full_join(Peace_Wonder_2007_long, Peace_Wonder_2014_long, by = c("Religion","Importance"))
# Check and clean any NA values that might result from the join if there are religions not present in both datasets
Peace_Wonder_combined <- drop_na(Peace_Wonder_combined)
# Changes in religion importance
Peace_Wonder_combined <- Peace_Wonder_combined %>%
mutate(Percentage_change = Percentage_2014 - Percentage_2007)
# Heatmap for both years
p <- ggplot(Peace_Wonder_combined, aes(x = Religion, y = Importance, fill = Percentage_change)) +
geom_tile() + # Create the tiles for the heatmap
scale_fill_gradient(low = "white", high = "steelblue") + # Gradient from white (low) to steel blue (high)
theme_minimal() +
theme(axis.text.x = element_text(angle = 45, hjust = 1), title = element_text(size = 15)) +
labs(title = "Changes in responses on the sense spritual by Religious Group",
x = "Religion",
y = "",
fill = "Percentage")
# Make it interactive
interactive_plot <- ggplotly(p , width = 1200 , height = 750)
# Show the interactive plot in your default browser
interactive_plotOverall Trends: Across most religious groups, there is a consistent pattern of a decrease in the proportion of respondents who report experiencing spiritual peace and well-being at least once a week, coupled with an increase in those reporting never experiencing it. This suggests a potential decline in regular spiritual practices or feelings of spiritual fulfillment over the surveyed period.
Variability Among Groups: While the overall trend shows a decrease in weekly spiritual experiences, the extent of this change varies among different religious groups. For instance, some groups, such as Jehovah’s Witnesses and Mormons, maintained high levels of weekly spiritual experiences, while others, like Buddhists and Hindus, showed more variability.
Shifts in “Never” Category: A significant increase in the proportion of respondents reporting never experiencing spiritual peace and well-being is notable across several religious groups. This shift raises questions about potential changes in religious participation, beliefs, or societal factors impacting spiritual practices.
Stability in Some Groups: Interestingly, certain groups, such as Muslims and Orthodox Christians, show relatively stable patterns in the frequency of spiritual experiences. This stability may reflect the resilience of traditional religious practices and beliefs within these communities over time.
Throughout Chapter 3, we have systematically examined the shifting landscapes of religious affiliation, the importance of religion, attitudes towards controversial cultural issues, and experiences of spiritual well-being. Our analyses span from broad demographic shifts to nuanced changes in beliefs and practices over time.
Changes in Religious Affiliations: - The analysis reveals a significant fluidity in religious affiliations between 2007 and 2014. Notably, there was a discernible trend towards non-affiliation, with increases in the “Nothing in particular” category, alongside rises in atheism and agnosticism. Simultaneously, traditional religious affiliations such as Protestantism and Catholicism saw declines, reflecting a broader trend of secularization in American society.
Changing Perceptions of Religion’s Importance: - The importance of religion has seen varying levels of decline across different groups, indicating a shift towards secular values over the surveyed period. However, contrasts remain stark among different religious communities, with some maintaining a strong emphasis on religious practices and beliefs.
Shifting Views on Religion and ‘Culture War’ Issues: - Attitudes towards contentious social issues like abortion and homosexuality have evolved, with a general trend towards more liberal views, especially among younger and less traditionally religious demographics. However, there remains substantial variability, with some groups showing remarkable consistency in their views due to deep-seated religious beliefs.
Changes in Frequency of Experiencing Spiritual Peace and Well-being: - There appears to be a general decline in regular spiritual experiences, with an increase in individuals reporting never experiencing spiritual peace and well-being. This change could reflect shifting engagement with traditional religious practices or broader societal changes affecting personal and communal spiritual lives.
For Chapter 4 of your project, you are conducting an exploration of religious dynamics, focusing specifically on how individuals transition between religions from childhood to adulthood. Your analysis aims to model the changing composition of religious affiliations in a society over time, using a matrix of transition probabilities. Here’s a structured and clear explanation of your approach and objectives:
The primary goal of this analysis is to understand the dynamics of religious affiliation in society by studying how individuals may change their religious affiliations from childhood to adulthood. You seek to:
Quantify the Transition Probabilities: Calculate the probability that a person born or identified with one religion (childhood religion) will transition to another religion (adulthood religion). This involves analyzing survey data to determine the proportion of individuals who switch from each religion to another, compared to the total number of individuals who started in each religion.
Simulate Religious Composition Over Time: Use the calculated transition probabilities to simulate how the distribution of religious affiliations changes over time within a fixed population. This simulation will help visualize potential trends and shifts in religious composition under the assumption that no other demographic factors (like birth, death, or immigration) affect the population.
Identify Steady States: Determine if the simulation reaches a steady state where the proportions of each religion in the population remain constant over successive time periods, suggesting a balance in how individuals transition between religions.
For each religion X (childhood religion), calculate the probability of transitioning to each religion Y (adulthood religion) as follows:
\[ P(Y|X) = \frac{\text{Number of people who changed their religion from } X \text{ to } Y}{\text{Total number of children with religion } X} \]
This results in a transition matrix where each element (i, j) represents the probability of transitioning from religion i to religion j.
# the columns are named 'qj1' for childhood religion and 'qe1' for current religion
transition_counts <- survey_data_2014 %>%
filter(!is.na(qj1) & !is.na(qe1)) %>%
group_by(qj1) %>%
filter(n()>100) %>%
ungroup() %>%
group_by(qe1) %>%
filter(n()>150) %>%
ungroup() %>%
group_by(qj1,qe1) %>%
filter(n()>10) %>%
summarise(count = n()) %>%
ungroup()
# Summarize total counts for each childhood religion
total_per_child_religion <- transition_counts %>%
group_by(qj1) %>%
summarise(Total_Count = sum(count))
# Calculate percentages
transition_percentages <- transition_counts %>%
left_join(total_per_child_religion, by = "qj1") %>%
mutate(Percentage = (count / Total_Count) * 100) %>%
select(qj1, qe1, count, Percentage)
# Create nodes and links for the Sankey diagram
node_names <- unique(c(as.character(transition_counts$qj1), as.character(transition_counts$qk1)))
nodes <- data.frame(name = node_names)
links <- transition_counts %>%
mutate(source = match(qj1, node_names) - 1, # Indexing starts at 0 for JavaScript
target = match(qe1, node_names) - 1,
value = count)
# First we need to create an igraph object from the transition data
graph_data <- transition_percentages %>%
select(source = qj1, target = qe1, weight = Percentage)
# Create the graph object using igraph
graph <- graph_from_data_frame(transition_percentages, directed = TRUE)
# Create groups based on connected components if there is no explicit community detection
com <- components(graph)
grp <- com$membership
# Add group information to the nodes/vertices
V(graph)$group <- grp
mycolors <- RColorBrewer::brewer.pal(min(max(grp), 8), "Set1")
if (max(grp) > 8) {
mycolors <- grDevices::colors()[seq(from = 1, to = max(grp))]
}
names(mycolors) <- unique(grp)
# Make the arc diagram with ggraph
p <- ggraph(graph, layout = 'linear') +
geom_edge_arc(edge_width = 0.3, edge_colour="black", edge_alpha=0.2, fold=TRUE) +
geom_node_point(aes(size = degree(graph, v = V(graph)), color = factor(group)), alpha = 0.5) +
scale_size_continuous(range=c(0.5,8)) +
scale_color_manual(values=mycolors) +
geom_node_text(aes(label=name), angle=65, hjust=1, nudge_y = -1.1, size=2.3) +
labs(title = 'transition of religions')+
theme_void() +
theme(
title = element_text(size = 20),
legend.position="none",
plot.margin=unit(c(0,0,0.4,0), "null"),
panel.spacing=unit(c(0,0,3.4,0), "null")
) +
expand_limits(x = c(-1.2, 1.2), y = c(-5.6, 1.2))
# Use ggsave() to save the plot with specified dimensions
ggsave("arc_diagram.png", plot = p, width = 12, height = 8, units = "in", dpi = 300)
This arc diagram visually represents the transitions individuals make from their childhood religion to their current religion. Each node (dot) on the horizontal axis represents a different religious affiliation, and the arcs (curved lines) indicate the movement of people between these affiliations over time. The size of a node reflects the number of individuals who either remain in or leave a particular religion.
transition_percentages_2014_selected <- select(transition_percentages, qj1, qe1, Percentage)
transition_percentages_2014_wide <- pivot_wider(
transition_percentages_2014_selected,
names_from = qj1, # This column's unique values will become the names of the new columns
values_from = Percentage, # The cell values will come from the 'Percentage' column
values_fill = list(Percentage = 0) # Fill missing combinations with 0%
)
transition_percentages_2014_wide# Heatmap for both years
p <- ggplot(transition_percentages_2014_selected, aes(x = qe1, y = qj1, fill = Percentage)) +
geom_tile() + # Create the tiles for the heatmap
scale_fill_gradient(low = "white", high = "steelblue") + # Gradient from white (low) to steel blue (high)
theme_minimal() +
theme(axis.text.x = element_text(angle = 45, hjust = 1), title = element_text(size = 15)) +
labs(title = "Transition Probability of changing religion",
x = "Adulthood Religion",
y = "Childhood Religion",
fill = "Percentage")
# Make it interactive
interactive_plot <- ggplotly(p , width = 1200 , height = 750)
# Show the interactive plot in your default browser
interactive_plotThe heatmap depicts changes in religious affiliation from childhood to adulthood across various groups. Observing the concentration of darker shades along the diagonal would suggest that many individuals remain within their childhood religion. However, deviations from the diagonal where darker shades appear indicate notable transitions from one religion to another (notable for Protestant and Nothing in particular).
To simulate the evolution of the population’s religious affiliations, we start with an initial population vector \(\mathbf{P}(0)\), where each element \(P_i(0)\) represents the number of individuals affiliated with religion \(i\) at the beginning of our simulation (time \(t = 0\)).
At each subsequent time point \(t\), we update the population vector using the following formula:
\[ \mathbf{P}(t) = \mathbf{P}(t-1) \times \mathbf{T} \]
where: - \(\mathbf{P}(t)\) is the population vector at time \(t\), with \(P_i(t)\) being the number of individuals affiliated with religion \(i\). - \(\mathbf{P}(t-1)\) is the population vector from the previous time point \(t-1\). - \(\mathbf{T}\) is the transition matrix, with each element \(T_{ij}\) representing the probability of an individual transitioning from religion \(i\) to religion \(j\).
The multiplication of \(\mathbf{P}(t-1)\) by \(\mathbf{T}\) applies the transition probabilities to the population vector, producing a new distribution of religious affiliations at time \(t\). This process models how individuals may change their religious affiliations over time, allowing us to forecast the potential shifts in the religious composition of the population.
By repeating this calculation for each time step, we construct a time series of population vectors \(\{ \mathbf{P}(1), \mathbf{P}(2), \ldots, \mathbf{P}(t) \}\), which depict the dynamics of religious affiliation within the population across the simulated time periods.
# Convert percentage to probability
transition_matrix <- transition_percentages_2014_wide %>%
select(-qe1) %>% # Remove the first column which contains labels
mutate_all(~ .x / 100) # Convert percentages to probabilities
# Convert percentages to probabilities (divide by 100)
transition_percentages_2014_selected$Percentage <- transition_percentages_2014_selected$Percentage / 100
# Creating a wide matrix with all religions both in rows and columns
transition_matrix <- transition_percentages_2014_selected %>%
spread(key = qj1, value = Percentage, fill = 0) # Use the correct key and value fields
# Ensure all unique religions are included as rows and columns
all_religions <- union(unique(transition_percentages_2014_selected$qe1), unique(transition_percentages_2014_selected$qj1))
# Create an empty full transition matrix with zeros
full_matrix <- matrix(0, nrow = length(all_religions), ncol = length(all_religions),
dimnames = list(all_religions, all_religions))
# Fill the full matrix with the available probabilities
for (i in 1:nrow(transition_percentages_2014_selected)) {
from_religion <- transition_percentages_2014_selected$qe1[i]
to_religion <- transition_percentages_2014_selected$qj1[i]
probability <- transition_percentages_2014_selected$Percentage[i]
full_matrix[from_religion, to_religion] <- probability
}
# Convert to a data frame for visualization/checking
transition_df <- as.data.frame(full_matrix)
simulate_religion_dynamics <- function(pop, P, max_time) {
pop_matrix <- matrix(0, nrow = max_time, ncol = length(pop))
pop_matrix[1,] <- pop
for (t in 2:max_time) {
pop_matrix[t,] <- pop_matrix[t-1,] %*% P
}
return(pop_matrix)
}
# Initial Population based on the data
initial_population <- c(1474 , 1098 , 5000, 15000, 264, 750, 7200, 200, 199, 244, 847, 664, 237, 186)
# Run the simulation
result <- simulate_religion_dynamics(initial_population, t(full_matrix), max_time = 40)
# Assuming 'result' is your matrix from the simulation
result_df <- as.data.frame(result)
time <- 1:nrow(result_df)
result_df <- cbind(time, result_df)
# Melt the data frame for ggplot
result_long <- result_df %>%
pivot_longer(cols = -time, names_to = "Religion", values_to = "Population")
# # Name the religions appropriately if not automatically named
religions <- names(transition_df)
result_long$Religion <- rep(religions, times = 40)
p <- ggplot(result_long, aes(x = time, y = Population, color = Religion )) +
geom_line() +
theme_minimal() +
labs(title = "Religion Population Dynamics",
x = "Time",
y = "Population") +
theme(legend.title = element_blank())
# Make it interactive
interactive_plot <- ggplotly(p , width = 1200 , height = 600)
# Show the interactive plot in your default browser
interactive_plotThe graph shows us a snapshot of religious shifts over time. We observe that the number of individuals identifying as Protestant and those stating “Nothing in particular” are on the rise, while the Roman Catholic group is seeing a decrease. Other religions appear to be fairly steady in their numbers. These trends are mostly consistent with the actual changes in religious affiliation observed between 2007 and 2014, with the growth of the Protestant group as an exception.
It’s important to note that this is a simplified model that doesn’t account for factors like immigration, birth, and mortality rates, which all play a significant role in shaping the religious composition of a population. Nonetheless, this model serves as a promising starting point for more detailed future studies that could incorporate these additional elements.
Understanding how and why individuals change their religious beliefs over time is crucial for both sociological research and practical applications within community planning and policy making. The complexity of religious belief systems and their influence on personal and social life demand a sophisticated analytical approach to capture the nuanced changes individuals may experience.
# Calculate the percentage of missing values for each column
missing_percentage <- sapply(survey_data_2014, function(x) sum(is.na(x)) / length(x)) * 100
# Set threshold for removal
threshold <- 0
# Find columns with missing value percentage greater than the threshold
columns_to_remove <- names(missing_percentage[missing_percentage > threshold])
# Remove the columns from the dataset
data_clean_2014 <- survey_data_2014[, !(names(survey_data_2014) %in% columns_to_remove)]
data_clean_2014 <- data_clean_2014 %>%
mutate(Religion_Change = if_else(qj1 == qe1, "Same", "Changed")) %>%
filter(respondent_birthregion != "Don't know/refused") %>% # Remove "Don't know/refused"
mutate(Immigration_Status = if_else(respondent_birthregion == "U.S.", "Non-Immigrant", "Immigrant"))
# # Remove feature
data_clean_2014 <- select(data_clean_2014,-qj1, -qe1)
# # Ensure the target variable is a factor
data_clean_2014$Religion_Change <- factor(data_clean_2014$Religion_Change)
data_clean_2014 <- data_clean_2014 %>%
select( -RELTRAD, -CHRELTRAD, -CHFAMILY, -CHDENOM, -CHPROTFAM, -FAMILY, -PROTFAM, -DENOM, -WEIGHT, -resp,-...1,)
set.seed(123) # for reproducibility
indices <- sample(1:nrow(data_clean_2014), size = 0.7 * nrow(data_clean_2014))
train_data <- data_clean_2014[indices, ]
test_data <- data_clean_2014[-indices, ]
rf_classifier <- randomForest(Religion_Change ~ ., data = train_data, ntree = 200)
# Making predictions
predictions <- predict(rf_classifier, test_data)
# Evaluate model performance
conf_matrix <- table(Predicted = predictions, Actual = test_data$Religion_Change)
accuracy <- sum(diag(conf_matrix)) / sum(conf_matrix)
print(paste("Accuracy: ", accuracy))## [1] "Accuracy: 0.750549345562243"
## Actual
## Predicted Changed Same
## Changed 1683 597
## Same 2014 6173
#rain the Random Forest classifier using the training data. Assume that all other columns except your target variable (Religion_Change) are predictors.The accuracy of your Random Forest model is approximately 75.05%, indicating that about three-quarters of the predictions made by the model are correct. The confusion matrix provides a more detailed breakdown of the model’s performance:
# Assuming 'rf' is your trained random forest model
importance_data <- importance(rf_classifier)
importance_df <- as.data.frame(importance_data)
importance_df$Feature <- rownames(importance_df)
# Using ggplot2 to create the importance plot with gradient color
p <- ggplot(importance_df, aes(x = reorder(Feature, MeanDecreaseGini), y = MeanDecreaseGini, fill = MeanDecreaseGini)) +
geom_col() + # Removing the specific fill color from geom_col
scale_fill_gradient(low = "lightblue", high = "dodgerblue") + # Define gradient from light blue to dodger blue
coord_flip() + # Flip coordinates for horizontal layout
labs(title = "Feature Importance", x = "Features", y = "Increase in Node Purity") +
theme_minimal()
# Make it interactive
interactive_plot <- ggplotly(p , width = 1200 , height = 1000)
# Show the interactive plot in your default browser
interactive_plotIn my analysis, numerous features significantly impact the classification results. However, for the next phase of the study, I aim to focus on features that offer clearer interpretability. Specifically, we plan to hone in on variables like income, education, age, political affiliation, marital status, self-reported happiness, and geographic location. These factors are not only straightforward to understand but also tend to have direct and tangible effects on individuals’ life decisions and perspectives.
By narrowing our analysis to these interpretable factors, I hope to see how the results differ when we limit the model to variables that are more conceptually accessible and traditionally relevant in sociological research. Additionally, this approach will allow us to identify which of these easily understandable factors are most influential in predicting changes in religious affiliation, thereby enhancing the practical applicability and relevance of our findings.
data_clean_2014 <- data_clean_2014 %>%
select(Religion_Change , agerec, income, educ, state, cregion, marital, qa1, qa2a, qa2b, qf2, attend)
# Renaming columns
data_clean_2014 <- data_clean_2014 %>%
rename(
religious_importance = qf2,
happiness = qa1,
family_life_satisfaction = qa2a,
health_life_satisfaction = qa2b,
)
set.seed(123) # for reproducibility
indices <- sample(1:nrow(data_clean_2014), size = 0.7 * nrow(data_clean_2014))
train_data <- data_clean_2014[indices, ]
test_data <- data_clean_2014[-indices, ]
rf_classifier <- randomForest(Religion_Change ~ ., data = train_data, ntree = 200)
# Making predictions
predictions <- predict(rf_classifier, test_data)
# Evaluate model performance
conf_matrix <- table(Predicted = predictions, Actual = test_data$Religion_Change)
accuracy <- sum(diag(conf_matrix)) / sum(conf_matrix)
print(paste("Accuracy: ", accuracy))## [1] "Accuracy: 0.717206458393045"
## Actual
## Predicted Changed Same
## Changed 1581 844
## Same 2116 5926
Even after reducing the dimensionality of our feature set to focus on 11 easily interpretable factors, the results remain quite comparable to the previous broader model. The accuracy of the current model stands at approximately 71.72%, only slightly lower than the earlier model’s accuracy of 75.05%. This suggests that these selected interpretable factors—such as income, education, age, and others—still capture a significant portion of the variability needed to predict changes in religious affiliation effectively. This reduction in complexity, while maintaining a similar level of predictive power, underscores the relevance and robustness of these key factors in our analysis.
# Assuming 'rf' is your trained random forest model
importance_data <- importance(rf_classifier)
importance_df <- as.data.frame(importance_data)
importance_df$Feature <- rownames(importance_df)
# Using ggplot2 to create the importance plot with gradient color
p <- ggplot(importance_df, aes(x = reorder(Feature, MeanDecreaseGini), y = MeanDecreaseGini, fill = MeanDecreaseGini)) +
geom_col() + # Removing the specific fill color from geom_col
scale_fill_gradient(low = "lightblue", high = "dodgerblue") + # Define gradient from light blue to dodger blue
coord_flip() + # Flip coordinates for horizontal layout
labs(title = "Feature Importance", x = "Features", y = "Increase in Node Purity") +
theme_minimal()
# Make it interactive
interactive_plot <- ggplotly(p , width = 1200 , height = 600)
# Show the interactive plot in your default browser
interactive_plotreligious_importance (1565.3918): This is the most significant factor, indicating the personal significance of religion to an individual. A higher or lower value here directly impacts one’s likelihood to maintain or change their religious affiliation, reflecting the core of how individuals perceive and prioritize their faith.
state (1495.3427): The state where an individual resides is a crucial factor, likely due to the diverse religious landscapes across different states. This can influence exposure to various religious practices and communities, affecting personal religious changes.
agerec (1269.5415): Age often correlates with changes in life perspective and priorities. As people age, their life experiences can lead to shifts in religious beliefs and practices, making this a key predictor of religious change.
income (1213.9837): Financial status influences many aspects of a person’s life, including the ability to participate in certain religious activities, exposure to diverse cultures, and general life satisfaction, all of which can affect religious affiliation.
educ (979.5771): Educational attainment exposes individuals to various worldviews and critical thinking skills, which can lead to questioning and potentially changing religious beliefs.
attend (876.4653): The frequency with which individuals attend religious services is both an indicator of current religious engagement and a predictor of future religious adherence or change.
health_life_satisfaction (633.0054): How satisfied individuals are with their health can impact their spiritual beliefs, particularly as people often turn towards or away from spirituality in times of health crises.
marital (646.6567): Changes in marital status can profoundly affect personal life, including religious practices and beliefs, as marriage can introduce new dynamics and influences regarding religion.
happiness (552.6725): Overall happiness might influence how individuals feel about their current religious standings. Satisfied individuals might see no reason for change, whereas those less happy might seek new spiritual paths.
cregion (469.2322): Similar to state, the broader cultural and regional setting can influence religious practices and changes, reflecting the social and cultural diversity impacting religious identity.
family_life_satisfaction (435.1318): Satisfaction with family life can significantly influence religious stability or change. Family dynamics often play a crucial role in religious upbringing and continued practice.
These factors, listed by their importance, provide a comprehensive view of the determinants most predictive of changes in religious affiliation. Understanding these can help in developing targeted interventions, policies, and further research into the dynamics of religious identity.
In exploring factors that influence changes in religious beliefs, it’s crucial to employ a statistical method that not only effectively handles binary outcomes but also provides interpretable results. This is where Generalized Linear Models (GLM) come into play, offering a robust framework for our analysis.
Why GLM? GLMs are particularly adept at modeling binary outcomes—such as whether an individual has changed their religious affiliation (Yes/No). This capability stems from the model’s use of a logistic function, which naturally maps any input through predictors to a probability between 0 and 1, perfectly suiting binary classification tasks.
Additionally, GLMs bring a high level of interpretability to the table. Each predictor’s effect is quantified with a coefficient that directly corresponds to the change in the log odds of the outcome per unit change in the predictor, holding all other predictors constant. This characteristic makes it easier to understand which factors are most influential in determining religious changes and allows these effects to be directly communicated in terms of odds ratios—a format that is intuitively understandable for both technical and non-technical audiences.
# First make sure to use as.factor for catagorical predictors
data_clean_2014$religious_importance <- as.factor(data_clean_2014$religious_importance)
data_clean_2014$educ <- as.factor(data_clean_2014$educ)
data_clean_2014$income <- as.factor(data_clean_2014$income)
data_clean_2014$marital <- as.factor(data_clean_2014$marital)
data_clean_2014$attend <- as.factor(data_clean_2014$attend)
data_clean_2014$agerec <- as.factor(data_clean_2014$agerec)
glm_model <- glm(Religion_Change ~ income + educ + agerec + marital + attend + religious_importance , family = binomial(link = "logit"), data = data_clean_2014)
# Display the summary of the model
summary(glm_model)##
## Call:
## glm(formula = Religion_Change ~ income + educ + agerec + marital +
## attend + religious_importance, family = binomial(link = "logit"),
## data = data_clean_2014)
##
## Coefficients:
## Estimate
## (Intercept) -1.07512
## income$150,000 or more 0.02589
## income10 to under $20,000 -0.14114
## income100 to under $150,000 0.03947
## income20 to under $30,000 -0.14344
## income30 to under $40,000 -0.05627
## income40 to under $50,000 -0.01191
## income50 to under $75,000 -0.02349
## income75 to under $100,000 -0.02663
## incomeLess than $10,000 -0.23246
## educFour year college or university degree/Bachelor's degree (e.g., BS, BA, AB) 0.30998
## educHigh school graduate (Grade 12 with diploma or GED certificate) 0.41271
## educHigh school incomplete (Grades 9-11 or Grade 12 with NO diploma) 0.34843
## educLess than high school (Grades 1-8 or no formal schooling) 0.50747
## educPostgraduate or professional degree, including master's, doctorate, medical or law degree (e.g., MA, MS, PhD, MD...) 0.30821
## educSome college, no degree (includes some community college) 0.21628
## educSome postgraduate or professional schooling, no postgraduate degree (e.g. some graduate school) 0.36987
## educTwo year associate degree from a college or university 0.27343
## agerec35-39 -0.07722
## agerec40-44 0.03336
## agerec45-49 0.16720
## agerec50-54 0.17924
## agerec55-59 0.22840
## agerec60-64 0.30649
## agerec65-69 0.45991
## agerec70-74 0.38036
## agerec75-79 0.54391
## agerec80-84 0.57401
## agerec85-89 0.88778
## agerecAge 24 or younger -0.03947
## agerecAge 25-29 -0.04880
## agerecAge 90 or older 0.96888
## agerecDon't know/refused 0.27943
## maritalDivorced 0.26950
## maritalLiving with a partner 0.17214
## maritalMarried 0.36426
## maritalNever been married 0.45845
## maritalSeparated 0.30206
## maritalWidowed 0.44564
## attendA few times a year 0.22583
## attendMore than once a week 0.22907
## attendNever -0.60065
## attendOnce a week 0.38835
## attendOnce or twice a month 0.40638
## attendSeldom -0.24097
## religious_importanceNot at all important -0.73885
## religious_importanceNot too important 0.18073
## religious_importanceSomewhat important 0.91826
## religious_importanceVery important 1.16394
## Std. Error
## (Intercept) 0.29580
## income$150,000 or more 0.05738
## income10 to under $20,000 0.05555
## income100 to under $150,000 0.05402
## income20 to under $30,000 0.05443
## income30 to under $40,000 0.05560
## income40 to under $50,000 0.05719
## income50 to under $75,000 0.05018
## income75 to under $100,000 0.05251
## incomeLess than $10,000 0.06093
## educFour year college or university degree/Bachelor's degree (e.g., BS, BA, AB) 0.19063
## educHigh school graduate (Grade 12 with diploma or GED certificate) 0.19068
## educHigh school incomplete (Grades 9-11 or Grade 12 with NO diploma) 0.19854
## educLess than high school (Grades 1-8 or no formal schooling) 0.20471
## educPostgraduate or professional degree, including master's, doctorate, medical or law degree (e.g., MA, MS, PhD, MD...) 0.19147
## educSome college, no degree (includes some community college) 0.19114
## educSome postgraduate or professional schooling, no postgraduate degree (e.g. some graduate school) 0.20588
## educTwo year associate degree from a college or university 0.19274
## agerec35-39 0.06767
## agerec40-44 0.06658
## agerec45-49 0.06546
## agerec50-54 0.06205
## agerec55-59 0.06142
## agerec60-64 0.06199
## agerec65-69 0.06418
## agerec70-74 0.06882
## agerec75-79 0.08112
## agerec80-84 0.09016
## agerec85-89 0.12265
## agerecAge 24 or younger 0.06495
## agerecAge 25-29 0.06658
## agerecAge 90 or older 0.17978
## agerecDon't know/refused 0.10781
## maritalDivorced 0.17970
## maritalLiving with a partner 0.18310
## maritalMarried 0.17697
## maritalNever been married 0.17926
## maritalSeparated 0.19354
## maritalWidowed 0.18237
## attendA few times a year 0.16225
## attendMore than once a week 0.16324
## attendNever 0.16426
## attendOnce a week 0.16205
## attendOnce or twice a month 0.16341
## attendSeldom 0.16230
## religious_importanceNot at all important 0.13593
## religious_importanceNot too important 0.13333
## religious_importanceSomewhat important 0.13091
## religious_importanceVery important 0.12995
## z value
## (Intercept) -3.635
## income$150,000 or more 0.451
## income10 to under $20,000 -2.541
## income100 to under $150,000 0.731
## income20 to under $30,000 -2.635
## income30 to under $40,000 -1.012
## income40 to under $50,000 -0.208
## income50 to under $75,000 -0.468
## income75 to under $100,000 -0.507
## incomeLess than $10,000 -3.815
## educFour year college or university degree/Bachelor's degree (e.g., BS, BA, AB) 1.626
## educHigh school graduate (Grade 12 with diploma or GED certificate) 2.164
## educHigh school incomplete (Grades 9-11 or Grade 12 with NO diploma) 1.755
## educLess than high school (Grades 1-8 or no formal schooling) 2.479
## educPostgraduate or professional degree, including master's, doctorate, medical or law degree (e.g., MA, MS, PhD, MD...) 1.610
## educSome college, no degree (includes some community college) 1.132
## educSome postgraduate or professional schooling, no postgraduate degree (e.g. some graduate school) 1.797
## educTwo year associate degree from a college or university 1.419
## agerec35-39 -1.141
## agerec40-44 0.501
## agerec45-49 2.554
## agerec50-54 2.889
## agerec55-59 3.719
## agerec60-64 4.944
## agerec65-69 7.166
## agerec70-74 5.527
## agerec75-79 6.705
## agerec80-84 6.367
## agerec85-89 7.238
## agerecAge 24 or younger -0.608
## agerecAge 25-29 -0.733
## agerecAge 90 or older 5.389
## agerecDon't know/refused 2.592
## maritalDivorced 1.500
## maritalLiving with a partner 0.940
## maritalMarried 2.058
## maritalNever been married 2.557
## maritalSeparated 1.561
## maritalWidowed 2.444
## attendA few times a year 1.392
## attendMore than once a week 1.403
## attendNever -3.657
## attendOnce a week 2.397
## attendOnce or twice a month 2.487
## attendSeldom -1.485
## religious_importanceNot at all important -5.435
## religious_importanceNot too important 1.356
## religious_importanceSomewhat important 7.014
## religious_importanceVery important 8.957
## Pr(>|z|)
## (Intercept) 0.000278
## income$150,000 or more 0.651860
## income10 to under $20,000 0.011069
## income100 to under $150,000 0.465053
## income20 to under $30,000 0.008405
## income30 to under $40,000 0.311455
## income40 to under $50,000 0.834978
## income50 to under $75,000 0.639730
## income75 to under $100,000 0.612022
## incomeLess than $10,000 0.000136
## educFour year college or university degree/Bachelor's degree (e.g., BS, BA, AB) 0.103930
## educHigh school graduate (Grade 12 with diploma or GED certificate) 0.030437
## educHigh school incomplete (Grades 9-11 or Grade 12 with NO diploma) 0.079269
## educLess than high school (Grades 1-8 or no formal schooling) 0.013176
## educPostgraduate or professional degree, including master's, doctorate, medical or law degree (e.g., MA, MS, PhD, MD...) 0.107458
## educSome college, no degree (includes some community college) 0.257834
## educSome postgraduate or professional schooling, no postgraduate degree (e.g. some graduate school) 0.072411
## educTwo year associate degree from a college or university 0.156001
## agerec35-39 0.253811
## agerec40-44 0.616329
## agerec45-49 0.010643
## agerec50-54 0.003870
## agerec55-59 0.000200
## agerec60-64 7.64e-07
## agerec65-69 7.70e-13
## agerec70-74 3.26e-08
## agerec75-79 2.01e-11
## agerec80-84 1.93e-10
## agerec85-89 4.55e-13
## agerecAge 24 or younger 0.543396
## agerecAge 25-29 0.463629
## agerecAge 90 or older 7.08e-08
## agerecDon't know/refused 0.009545
## maritalDivorced 0.133687
## maritalLiving with a partner 0.347146
## maritalMarried 0.039560
## maritalNever been married 0.010544
## maritalSeparated 0.118581
## maritalWidowed 0.014542
## attendA few times a year 0.163967
## attendMore than once a week 0.160547
## attendNever 0.000255
## attendOnce a week 0.016552
## attendOnce or twice a month 0.012887
## attendSeldom 0.137621
## religious_importanceNot at all important 5.47e-08
## religious_importanceNot too important 0.175246
## religious_importanceSomewhat important 2.31e-12
## religious_importanceVery important < 2e-16
##
## (Intercept) ***
## income$150,000 or more
## income10 to under $20,000 *
## income100 to under $150,000
## income20 to under $30,000 **
## income30 to under $40,000
## income40 to under $50,000
## income50 to under $75,000
## income75 to under $100,000
## incomeLess than $10,000 ***
## educFour year college or university degree/Bachelor's degree (e.g., BS, BA, AB)
## educHigh school graduate (Grade 12 with diploma or GED certificate) *
## educHigh school incomplete (Grades 9-11 or Grade 12 with NO diploma) .
## educLess than high school (Grades 1-8 or no formal schooling) *
## educPostgraduate or professional degree, including master's, doctorate, medical or law degree (e.g., MA, MS, PhD, MD...)
## educSome college, no degree (includes some community college)
## educSome postgraduate or professional schooling, no postgraduate degree (e.g. some graduate school) .
## educTwo year associate degree from a college or university
## agerec35-39
## agerec40-44
## agerec45-49 *
## agerec50-54 **
## agerec55-59 ***
## agerec60-64 ***
## agerec65-69 ***
## agerec70-74 ***
## agerec75-79 ***
## agerec80-84 ***
## agerec85-89 ***
## agerecAge 24 or younger
## agerecAge 25-29
## agerecAge 90 or older ***
## agerecDon't know/refused **
## maritalDivorced
## maritalLiving with a partner
## maritalMarried *
## maritalNever been married *
## maritalSeparated
## maritalWidowed *
## attendA few times a year
## attendMore than once a week
## attendNever ***
## attendOnce a week *
## attendOnce or twice a month *
## attendSeldom
## religious_importanceNot at all important ***
## religious_importanceNot too important
## religious_importanceSomewhat important ***
## religious_importanceVery important ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 45368 on 34889 degrees of freedom
## Residual deviance: 39146 on 34841 degrees of freedom
## AIC: 39244
##
## Number of Fisher Scoring iterations: 4
Significant Predictors: Variables such as income levels (especially the lowest income bracket), educational attainment, age categories, marital status, frequency of attending religious services, and the importance placed on religion are significant predictors in your model. These factors exhibit a range of influences, with some increasing and others decreasing the likelihood of changing religious affiliation.
For example:
To better understand the model performance and to ensure the robustness of the findings, consider visualizing the following:
# Extract residuals
residuals_data <- data.frame(Residuals = residuals(glm_model, type = "deviance"))
# For logistic regression, residuals won't be perfectly normal, but let's visualize:
ggplot(residuals_data, aes(x = seq_along(Residuals), y = Residuals)) +
geom_point(alpha = 0.5) +
labs(x = "Index", y = "Residuals", title = "Plot of Residuals") +
theme_minimal() +
theme(plot.title = element_text(hjust = 0.5))p <- ggplot(residuals_data, aes(x = Residuals)) +
geom_histogram(aes(y = ..density..), bins = 30, fill = "blue", alpha = 0.5) +
geom_density(color = "red") +
labs(x = "Residuals", y = "Density", title = "Histogram and Density Plot of Residuals") +
theme_minimal() +
theme(plot.title = element_text(hjust = 0.5))
# Make it interactive
interactive_plot <- ggplotly(p , width = 1200 , height = 600)
# Show the interactive plot in your default browser
interactive_plotThese observations can inform us about the model fit. While a degree of asymmetry in residuals can be expected in logistic regression, significant deviations from the expected distribution may suggest model mis-specifications, non-linearity in the data that the model hasn’t captured.
# Assuming you have a binary outcome
probabilities <- predict(glm_model, type = "response")
roc_curve <- roc(response = data_clean_2014$Religion_Change, predictor = probabilities)## Setting levels: control = Changed, case = Same
## Setting direction: controls < cases
# Create a data frame for ggplot
roc_data <- data.frame(
FPR = 1- roc_curve$specificities,
TPR = roc_curve$sensitivities
)
# Plot ROC curve using ggplot2
ggplot(roc_data, aes(x = FPR, y = TPR)) +
geom_line(color = "darkorange") +
geom_abline(linetype = "dashed") +
labs(x = "False Positive Rate", y = "True Positive Rate", title = "ROC Curve") +
theme_minimal() +
geom_area(alpha = 0.2) +
geom_segment(aes(x = 0, y = 0, xend = 1, yend = 1), color = "navy", linetype = "dashed") +
annotate("text", x = 0.5, y = 0.25, label = paste("AUC =", round(auc(roc_curve), 2)), color = "red")
With an AUC of 0.73, the model has good predictive ability, significantly better than random guessing, which would have an AUC of 0.5. An AUC value in the range of 0.7 to 0.8 indicates that the model has a fair discrimination ability to differentiate between the two classes: those who have changed their religious affiliation and those who have not.
# Create a dataframe for ggplot
predictions_data <- data.frame(
Actual = data_clean_2014$Religion_Change,
Predicted_Probability = probabilities
)
# Plot Predicted Probabilities vs Actual Outcomes
p <- ggplot(predictions_data, aes(x = Predicted_Probability, fill = Actual)) +
geom_histogram(position = "identity", alpha = 0.5, bins = 30) +
labs(x = "Predicted Probability", y = "Count", title = "Predicted vs Actual Outcomes") +
scale_fill_brewer(palette = "Set1", name = "Actual Outcome") +
theme_minimal() +
theme(legend.position = "bottom", plot.title = element_text(hjust = 0.5))
# Make it interactive
interactive_plot <- ggplotly(p , width = 1200 , height = 600)
# Show the interactive plot in your default browser
interactive_plotThe plot reveals that our model is more adept at predicting instances where individuals retain their childhood religious affiliation (‘Same’ class) than instances where they change their religious beliefs (‘Changed’ class). This discrepancy might stem from an imbalance in the dataset, where there are significantly more cases of one class compared to the other. As a result, the model may have learned the patterns associated with the ‘Same’ class more effectively because there were more examples to learn from, leading to a less robust understanding of the ‘Changed’ class characteristics. Addressing this imbalance could potentially improve the model’s ability to discern the subtler patterns that indicate a shift in religious affiliation.
In Chapter 4, I embarked on an analytical journey to model the dynamics of religious affiliation changes using a transition probability approach. Our exploration aimed to quantify how individuals transition between religious affiliations from childhood to adulthood and to simulate these changes over time within a societal context.
Key Findings:
Transition Probabilities: successfully quantified the probabilities of transitioning from one religious affiliation to another. The transition matrix constructed from these probabilities revealed detailed insights into the patterns of religious switching. Notably, significant transitions were observed towards non-affiliation (‘Nothing in particular’), and there was an evident decline in traditional affiliations such as Protestantism and Catholicism.
Simulation Insights: The simulation of religious composition over time highlighted potential trends and shifts in religious demographics. It demonstrated how the religious landscape could evolve, emphasizing the growing prevalence of religious non-affiliation alongside the decreasing proportions of established denominations.
Steady State Analysis: Our analysis sought to determine if the distribution of religious affiliations would reach a steady state, where the proportions of each religion stabilize over time. The findings suggested that while some form of equilibrium could be anticipated, the religious landscape remains dynamically influenced by various social, cultural, and personal factors.
Methodological Insights:
My methodology involved calculating transition probabilities and applying these to simulate the evolution of religious affiliations in a hypothetical population. This approach provided a framework for understanding the fluidity and changing nature of religious identities.
The visualization techniques employed, including heatmaps of transition probabilities and time-series graphs of religious compositions, offered a clear and engaging representation of our findings, facilitating a deeper understanding of the underlying dynamics.
Challenges and Limitations:
One of the primary challenges was the inherent data imbalance in religious affiliations, which influenced the model’s predictions and interpretations, particularly underrepresenting minority religious groups.
Additionally, the model assumptions did not account for external factors such as immigration, birth, and death rates, which are crucial in real-world demographic studies. Future models would benefit from integrating these elements to provide more comprehensive insights.
Implications and Future Directions:
The study’s findings are crucial for policymakers, religious leaders, educators, and sociologists as they provide a quantified insight into how religious affiliations are changing over generations. This knowledge can help in crafting strategies that address the needs and preferences of diverse religious groups.
Future research could expand upon this foundational work by incorporating more complex demographic models and exploring the impact of socio-political changes on religious affiliations. Further, qualitative studies could complement this quantitative analysis to delve deeper into the reasons behind religious switching.
To properly cite the 2014 and 2007 Pew Research Center datasets in APA format, you can structure your references like this:
For the 2014 Dataset:
Pew Research Center. (2015). America’s Changing Religious Landscape. Retrieved from https://www.pewresearch.org/religion/2015/05/12/americas-changing-religious-landscape/
For the 2007 Dataset:
Pew Research Center. (2008). U.S. Religious Landscape Survey: Religious Beliefs and Practices. Retrieved from https://www.pewresearch.org/religion/2008/06/01/u-s-religious-landscape-survey-religious-beliefs-and-practices/